From c74cfa261ae990f848f79f1d00517d7cbba9395e Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 1 Oct 2020 00:27:01 +0000 Subject: user/horizon: Run update-boot when appropriate --- user/horizon/APKBUILD | 9 +++-- user/horizon/bootloader.patch | 94 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 user/horizon/bootloader.patch diff --git a/user/horizon/APKBUILD b/user/horizon/APKBUILD index b17cf786e..b49640561 100644 --- a/user/horizon/APKBUILD +++ b/user/horizon/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=horizon pkgver=0.9.5 -pkgrel=0 +pkgrel=1 pkgdesc="Installation tools for Adélie Linux" url="https://horizon.adelielinux.org/" arch="all" @@ -17,7 +17,9 @@ makedepends="bcnm-dev boost-dev cmake curl-dev eudev-dev libarchive-dev libcap-dev libx11-dev libxkbfile-dev qt5-qtbase-dev" subpackages="$pkgname-image $pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-qt5 $pkgname-tools $pkgname-wizard $pkgname-boot" -source="https://distfiles.adelielinux.org/source/horizon-$pkgver.tar.xz" +source="https://distfiles.adelielinux.org/source/horizon-$pkgver.tar.xz + bootloader.patch + " build() { if [ "$CBUILD" != "$CHOST" ]; then @@ -156,4 +158,5 @@ GLOBALS "$subpkgdir"/usr/share/xsessions/horizon.desktop } -sha512sums="373cbf87aa468d0ea41abad07f61cdaa6088cfdcba13c0beff245dbd8e270aa42c3e301a22913299d148e829114bd0b5aa746541c4b4b0c7286da35015c54d88 horizon-0.9.5.tar.xz" +sha512sums="373cbf87aa468d0ea41abad07f61cdaa6088cfdcba13c0beff245dbd8e270aa42c3e301a22913299d148e829114bd0b5aa746541c4b4b0c7286da35015c54d88 horizon-0.9.5.tar.xz +88e7c6df4dc2c8c7f6befd5f96f82267fefccb98d0c5e6c26c611323e505f7ee964dcfd2128dbe165c064d953e7afef2787ab49a6c4a834ffe8fd50c00eb26ae bootloader.patch" diff --git a/user/horizon/bootloader.patch b/user/horizon/bootloader.patch new file mode 100644 index 000000000..a09b4a603 --- /dev/null +++ b/user/horizon/bootloader.patch @@ -0,0 +1,94 @@ +From 3658104dcc622e69a64cf97fbc9ed477f3faed6c Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" +Date: Wed, 30 Sep 2020 19:19:59 -0500 +Subject: [PATCH] meta: Run update-boot when bootloader requested +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If the user chooses no-boot or isn't installing Adélie, this will fail +quietly. But if the user is installing Adélie, this is necessary to +generate bootloader configuration. +--- + hscript/meta.cc | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/hscript/meta.cc b/hscript/meta.cc +index 4efdc80..84e851a 100644 +--- a/hscript/meta.cc ++++ b/hscript/meta.cc +@@ -823,7 +823,7 @@ bool Bootloader::execute() const { + << std::endl + << "chroot " << script->targetDirectory() + << " grub-install " << _device << std::endl; +- return true; ++ goto updateboot; + } + #ifdef HAS_INSTALL_ENV + if(run_command("/sbin/apk", +@@ -851,8 +851,8 @@ bool Bootloader::execute() const { + mount(nullptr, efipath.c_str(), nullptr, + MS_REMOUNT | MS_BIND | MS_RDONLY | MS_NOEXEC | MS_NODEV | + MS_NOSUID | MS_RELATIME, nullptr); ++ goto updateboot; + #endif /* HAS_INSTALL_ENV */ +- return true; /* LCOV_EXCL_LINE */ + } + else if(method == "grub-bios") { + if(script->options().test(Simulate)) { +@@ -861,7 +861,7 @@ bool Bootloader::execute() const { + << std::endl + << "chroot " << script->targetDirectory() + << " grub-install " << _device << std::endl; +- return true; ++ goto updateboot; + } + #ifdef HAS_INSTALL_ENV + if(run_command("/sbin/apk", +@@ -876,8 +876,8 @@ bool Bootloader::execute() const { + output_error(pos, "bootloader: failed to install GRUB"); + return false; + } ++ goto updateboot; + #endif /* HAS_INSTALL_ENV */ +- return true; /* LCOV_EXCL_LINE */ + } + else if(method == "iquik") { + output_error(pos, "bootloader: iQUIK is not yet supported"); +@@ -891,7 +891,7 @@ bool Bootloader::execute() const { + << "chroot " << script->targetDirectory() + << " grub-install --macppc-directory=/boot/grub " + << _device << std::endl; +- return true; ++ goto updateboot; + } + #ifdef HAS_INSTALL_ENV + if(run_command("/sbin/apk", +@@ -907,9 +907,23 @@ bool Bootloader::execute() const { + output_error(pos, "bootloader: failed to install GRUB"); + return false; + } ++ goto updateboot; + #endif /* HAS_INSTALL_ENV */ +- return true; /* LCOV_EXCL_LINE */ + } + + return false; /* LCOV_EXCL_LINE */ ++ ++updateboot: ++ /* We ignore if update-boot fails, in case the user has chosen no-boot. */ ++ if(script->options().test(Simulate)) { ++ std::cout << "chroot " << script->targetDirectory() ++ << " /usr/sbin/update-boot || true" << std::endl; ++ } ++#ifdef HAS_INSTALL_ENV ++ else { ++ run_command("chroot", ++ {script->targetDirectory(), "/usr/sbin/update-boot"}); ++ } ++#endif /* HAS_INSTALL_ENV */ ++ return true; + } +-- +2.25.4 + -- cgit v1.2.3-70-g09d2