From be32732db2830b50d6400665ddcd4ed71c0805cc Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 23 Jun 2020 02:04:54 -0500 Subject: hscript: meta: desperate attempt to fix EFI installs --- hscript/meta.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hscript/meta.cc b/hscript/meta.cc index 164e55c..52ed3db 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -16,6 +16,7 @@ #include #include #ifdef HAS_INSTALL_ENV +# include # include "util/filesystem.hh" #endif /* HAS_INSTALL_ENV */ #include /* access - used by tz code even in RT env */ @@ -790,11 +791,22 @@ bool Bootloader::execute() const { output_error(pos, "bootloader: couldn't add package"); return false; } + + /* remount EFI vars r/w */ + mount(nullptr, "/sys/firmware/efi/efivars", nullptr, + MS_REMOUNT | MS_NOEXEC | MS_NODEV | MS_NOSUID | MS_RELATIME, + nullptr); + if(run_command("chroot", {script->targetDirectory(), "grub-install"}) != 0) { output_error(pos, "bootloader: failed to install GRUB"); return false; } + + /* done, back to r/o */ + mount(nullptr, "/sys/firmware/efi/efivars", nullptr, + MS_REMOUNT | MS_RDONLY | MS_NOEXEC | MS_NODEV | MS_NOSUID | + MS_RELATIME, nullptr); #endif return true; } -- cgit v1.2.3-70-g09d2