summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-13 19:08:26 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-13 19:08:26 -0500
commite427741ecf542257232840d1b3fb7ecca54cbd07 (patch)
treec7226d233035d6d3d0855bbc4d799b8ce07f4233
parent09f3b58c1d0568ef202231b267bf6324f6751964 (diff)
downloadhorizon-e427741ecf542257232840d1b3fb7ecca54cbd07.tar.gz
horizon-e427741ecf542257232840d1b3fb7ecca54cbd07.tar.bz2
horizon-e427741ecf542257232840d1b3fb7ecca54cbd07.tar.xz
horizon-e427741ecf542257232840d1b3fb7ecca54cbd07.zip
hscript: maybe implement bootloader key
-rw-r--r--hscript/meta.cc77
1 files changed, 77 insertions, 0 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc
index e42925e..164e55c 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -774,5 +774,82 @@ bool Bootloader::execute() const {
method = _value;
}
+ if(method == "grub-efi") {
+ if(script->options().test(Simulate)) {
+ std::cout << "apk --root " << script->targetDirectory()
+ << " --keys-dir etc/apk/keys add grub-efi"
+ << std::endl
+ << "chroot " << script->targetDirectory()
+ << " grub-install" << std::endl;
+ return true;
+ }
+#ifdef HAS_INSTALL_ENV
+ if(run_command("/sbin/apk",
+ {"--root", script->targetDirectory(), "--keys-dir",
+ "etc/apk/keys", "add", "grub-efi"}) != 0) {
+ output_error(pos, "bootloader: couldn't add package");
+ return false;
+ }
+ if(run_command("chroot", {script->targetDirectory(), "grub-install"})
+ != 0) {
+ output_error(pos, "bootloader: failed to install GRUB");
+ return false;
+ }
+#endif
+ return true;
+ }
+ else if(method == "grub-bios") {
+ if(script->options().test(Simulate)) {
+ std::cout << "apk --root " << script->targetDirectory()
+ << " --keys-dir etc/apk/keys add grub-bios"
+ << std::endl
+ << "chroot " << script->targetDirectory()
+ << " grub-install" << std::endl;
+ return true;
+ }
+#ifdef HAS_INSTALL_ENV
+ if(run_command("/sbin/apk",
+ {"--root", script->targetDirectory(), "--keys-dir",
+ "etc/apk/keys", "add", "grub-bios"}) != 0) {
+ output_error(pos, "bootloader: couldn't add package");
+ return false;
+ }
+ if(run_command("chroot", {script->targetDirectory(), "grub-install"})
+ != 0) {
+ output_error(pos, "bootloader: failed to install GRUB");
+ return false;
+ }
+#endif
+ return true;
+ }
+ else if(method == "iquik") {
+ output_error(pos, "bootloader: iQUIK is not yet supported");
+ return false;
+ }
+ else if(method == "grub-ieee1275") {
+ if(script->options().test(Simulate)) {
+ std::cout << "apk --root " << script->targetDirectory()
+ << " --keys-dir etc/apk/keys add grub-ieee1275"
+ << std::endl
+ << "chroot " << script->targetDirectory()
+ << " grub-install" << std::endl;
+ return true;
+ }
+#ifdef HAS_INSTALL_ENV
+ if(run_command("/sbin/apk",
+ {"--root", script->targetDirectory(), "--keys-dir",
+ "etc/apk/keys", "add", "grub-ieee1275"}) != 0) {
+ output_error(pos, "bootloader: couldn't add package");
+ return false;
+ }
+ if(run_command("chroot", {script->targetDirectory(), "grub-install"})
+ != 0) {
+ output_error(pos, "bootloader: failed to install GRUB");
+ return false;
+ }
+#endif
+ return true;
+ }
+
return false;
}