From bad8487c5332c38c15f8a6e979a19ae37de81736 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 15 Oct 2020 13:31:46 -0500 Subject: hscript: bootloader: Hopefully fix EFI once and for all --- hscript/meta.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hscript/meta.cc b/hscript/meta.cc index 12ed196..e3d05f2 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -846,9 +846,12 @@ bool Bootloader::execute() const { /* remount EFI vars r/w */ const auto efipath{script->targetDirectory() + "/sys/firmware/efi/efivars"}; - mount(nullptr, efipath.c_str(), nullptr, - MS_REMOUNT | MS_BIND | MS_NOEXEC | MS_NODEV | MS_NOSUID | - MS_RELATIME, nullptr); + if(mount("efivarfs", efipath.c_str(), "efivarfs", MS_NOEXEC | + MS_NODEV | MS_NOSUID | MS_RELATIME, nullptr) != 0) { + output_error(pos, "bootloader: failed to mount writable efivarfs", + strerror(errno)); + return false; + } if(run_command("chroot", {script->targetDirectory(), "grub-install", _device}) @@ -858,9 +861,7 @@ bool Bootloader::execute() const { } /* done, back to r/o */ - mount(nullptr, efipath.c_str(), nullptr, - MS_REMOUNT | MS_BIND | MS_RDONLY | MS_NOEXEC | MS_NODEV | - MS_NOSUID | MS_RELATIME, nullptr); + umount(efipath.c_str()); goto updateboot; #endif /* HAS_INSTALL_ENV */ } -- cgit v1.2.3-70-g09d2