summaryrefslogtreecommitdiff
path: root/hscript/meta.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-23 02:04:54 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-23 02:04:54 -0500
commitbe32732db2830b50d6400665ddcd4ed71c0805cc (patch)
tree4f76704d4e4c3dfb53a68d6f32b29bb9de2b3acf /hscript/meta.cc
parentca5486725468e69569ff352d0d075e8081e1e22d (diff)
downloadhorizon-be32732db2830b50d6400665ddcd4ed71c0805cc.tar.gz
horizon-be32732db2830b50d6400665ddcd4ed71c0805cc.tar.bz2
horizon-be32732db2830b50d6400665ddcd4ed71c0805cc.tar.xz
horizon-be32732db2830b50d6400665ddcd4ed71c0805cc.zip
hscript: meta: desperate attempt to fix EFI installs
Diffstat (limited to 'hscript/meta.cc')
-rw-r--r--hscript/meta.cc12
1 files changed, 12 insertions, 0 deletions
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 <set>
#include <sstream>
#ifdef HAS_INSTALL_ENV
+# include <sys/mount.h>
# include "util/filesystem.hh"
#endif /* HAS_INSTALL_ENV */
#include <unistd.h> /* 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;
}