summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-10-15 13:31:46 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-10-15 13:31:46 -0500
commitbad8487c5332c38c15f8a6e979a19ae37de81736 (patch)
treef81d49a598bc916a2a6cd709d0888925fbfa61b7
parente9870d0b830deb0b253e5e514fc90ceee201a778 (diff)
downloadhorizon-bad8487c5332c38c15f8a6e979a19ae37de81736.tar.gz
horizon-bad8487c5332c38c15f8a6e979a19ae37de81736.tar.bz2
horizon-bad8487c5332c38c15f8a6e979a19ae37de81736.tar.xz
horizon-bad8487c5332c38c15f8a6e979a19ae37de81736.zip
hscript: bootloader: Hopefully fix EFI once and for all
-rw-r--r--hscript/meta.cc13
1 files 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 */
}