1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
From 3658104dcc622e69a64cf97fbc9ed477f3faed6c Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
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
|