Merge ~ubuntu-core-dev/grub/+git/ubuntu:feature/initrd-less-boot-with-fallback-cleanup into ~ubuntu-core-dev/grub/+git/ubuntu:feature/initrd-less-boot-with-fallback

Proposed by Steve Langasek
Status: Merged
Merged at revision: c8cf1c2c54b1cd320c9239b0dc285f9d303aef2a
Proposed branch: ~ubuntu-core-dev/grub/+git/ubuntu:feature/initrd-less-boot-with-fallback-cleanup
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:feature/initrd-less-boot-with-fallback
Diff against target: 192 lines (+45/-40)
3 files modified
debian/.git-dpm (+2/-2)
debian/patches/add-initrd-less-boot-fallback.patch (+29/-25)
util/grub.d/10_linux.in (+14/-13)
Reviewer Review Type Date Requested Status
Chris Glass Pending
Review via email: mp+341216@code.launchpad.net

Description of the change

Two cleanups to the implementation vs. previous branch:
  - Clean up the indent handling to match existing practice.
  - Eliminate string duplication.
Perhaps not directly mergeable in present form due to git-dpm and rebasing, but looking for review before landing this.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/.git-dpm b/debian/.git-dpm
2index 7d8b55f..4da947c 100644
3--- a/debian/.git-dpm
4+++ b/debian/.git-dpm
5@@ -1,6 +1,6 @@
6 # see git-dpm(1) from git-dpm package
7-864dd07df01d460b04492080cb8c33590d175e94
8-864dd07df01d460b04492080cb8c33590d175e94
9+8ab8c3dcd38ba9b32006d02e06c78b04e7559c27
10+8ab8c3dcd38ba9b32006d02e06c78b04e7559c27
11 0992ffbac6a1b4c97c350d12e5301e0067daa0d6
12 0992ffbac6a1b4c97c350d12e5301e0067daa0d6
13 grub2_2.02.orig.tar.xz
14diff --git a/debian/patches/add-initrd-less-boot-fallback.patch b/debian/patches/add-initrd-less-boot-fallback.patch
15index ef9e00d..b397d47 100644
16--- a/debian/patches/add-initrd-less-boot-fallback.patch
17+++ b/debian/patches/add-initrd-less-boot-fallback.patch
18@@ -1,4 +1,4 @@
19-From 864dd07df01d460b04492080cb8c33590d175e94 Mon Sep 17 00:00:00 2001
20+From 8ab8c3dcd38ba9b32006d02e06c78b04e7559c27 Mon Sep 17 00:00:00 2001
21 From: Chris Glass <chris.glass@canonical.com>
22 Date: Thu, 8 Mar 2018 16:16:55 +0100
23 Subject: Added initrd-less boot capabilities.
24@@ -6,14 +6,19 @@ Subject: Added initrd-less boot capabilities.
25 In case the kernel fails to boot without an initrd, grub will fallback
26 to trying to boot the kernel with an initrd.
27
28+- Clean up the indent handling to match existing practice.
29+- Eliminate string duplication.
30+
31 Patch-Name: add-initrd-less-boot-fallback.patch
32+
33+Signed-off-by: Steve Langasek <steve.langasek@canonical.com>
34 ---
35 Makefile.am | 3 +++
36 configure.ac | 10 +++++++++
37- grub-initrd-fallback.service | 13 +++++++++++
38- util/grub.d/00_header.in | 27 ++++++++++++++++++++++
39- util/grub.d/10_linux.in | 53 ++++++++++++++++++++++++++++++++------------
40- 5 files changed, 92 insertions(+), 14 deletions(-)
41+ grub-initrd-fallback.service | 13 ++++++++++++
42+ util/grub.d/00_header.in | 27 ++++++++++++++++++++++++
43+ util/grub.d/10_linux.in | 50 +++++++++++++++++++++++++++++++++-----------
44+ 5 files changed, 91 insertions(+), 12 deletions(-)
45 create mode 100644 grub-initrd-fallback.service
46
47 diff --git a/Makefile.am b/Makefile.am
48@@ -114,7 +119,7 @@ index 674a76140..23322458a 100644
49 cat <<EOF
50 function recordfail {
51 diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
52-index 76d4f31bf..8590704a3 100644
53+index 76d4f31bf..fa615c3e0 100644
54 --- a/util/grub.d/10_linux.in
55 +++ b/util/grub.d/10_linux.in
56 @@ -104,6 +104,10 @@ if [ "$vt_handoff" = 1 ]; then
57@@ -128,7 +133,7 @@ index 76d4f31bf..8590704a3 100644
58 linux_entry ()
59 {
60 os="$1"
61-@@ -179,27 +183,48 @@ EOF
62+@@ -179,27 +183,49 @@ EOF
63 linux ${rel_dirname}/${basename}.efi.signed root=${linux_root_device_thisversion} ro ${args}
64 EOF
65 else
66@@ -139,29 +144,31 @@ index 76d4f31bf..8590704a3 100644
67 + if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
68 + linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
69 + fi
70++ message="$(gettext_printf "Loading initial ramdisk ...")"
71 + if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
72- sed "s/^/$submenu_indentation/" << EOF
73-- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
74-+ if [ "\${initrdfail}" = 1 ]; then
75-+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
76++ sed "s/^/$submenu_indentation/" << EOF
77++ if [ "\${initrdfail}" = 1 ]; then
78++ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
79 +EOF
80 + if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
81-+ message="$(gettext_printf "Loading initial ramdisk ...")"
82-+ echo " ${message}"
83++ sed "s/^/$submenu_indentation/" << EOF
84++ echo '$(echo "$message" | grub_quote)'
85++EOF
86 + fi
87 +
88-+ sed "s/^/$submenu_indentation/" << EOF
89-+ initrd ${rel_dirname}/${initrd}
90-+ else
91-+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
92-+ fi
93-+ initrdfail
94+ sed "s/^/$submenu_indentation/" << EOF
95+- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
96++ initrd ${rel_dirname}/${initrd}
97++ else
98++ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
99++ fi
100++ initrdfail
101 EOF
102 else
103 + # We don't have initrd or we don't want to set PARTUUID. Don't try initrd-less boot with fallback.
104 sed "s/^/$submenu_indentation/" << EOF
105 - linux ${rel_dirname}/${basename} root=PARTUUID=${GRUB_FORCE_PARTUUID} ro ${args}
106-+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
107++ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
108 EOF
109 - fi
110 - fi
111@@ -170,21 +177,18 @@ index 76d4f31bf..8590704a3 100644
112 - if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
113 - message="$(gettext_printf "Loading initial ramdisk ...")"
114 - sed "s/^/$submenu_indentation/" << EOF
115-- echo '$(echo "$message" | grub_quote)'
116 + if test -n "${initrd}"; then
117 + # We do have initrd - let's use it at boot.
118 + # TRANSLATORS: ramdisk isn't identifier. Should be translated.
119 + if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
120-+ message="$(gettext_printf "Loading initial ramdisk ...")"
121 + sed "s/^/$submenu_indentation/" << EOF
122-+ echo '$(echo "$message" | grub_quote)'
123+ echo '$(echo "$message" | grub_quote)'
124 EOF
125 - fi
126 - sed "s/^/$submenu_indentation/" << EOF
127-- initrd ${rel_dirname}/${initrd}
128 + fi
129 + sed "s/^/$submenu_indentation/" << EOF
130-+ initrd ${rel_dirname}/${initrd}
131+ initrd ${rel_dirname}/${initrd}
132 EOF
133 + fi
134 + fi
135diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
136index 8590704..fa615c3 100644
137--- a/util/grub.d/10_linux.in
138+++ b/util/grub.d/10_linux.in
139@@ -189,39 +189,40 @@ EOF
140 if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
141 linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
142 fi
143+ message="$(gettext_printf "Loading initial ramdisk ...")"
144 if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
145 sed "s/^/$submenu_indentation/" << EOF
146- if [ "\${initrdfail}" = 1 ]; then
147- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
148+ if [ "\${initrdfail}" = 1 ]; then
149+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
150 EOF
151 if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
152- message="$(gettext_printf "Loading initial ramdisk ...")"
153- echo " ${message}"
154+ sed "s/^/$submenu_indentation/" << EOF
155+ echo '$(echo "$message" | grub_quote)'
156+EOF
157 fi
158
159 sed "s/^/$submenu_indentation/" << EOF
160- initrd ${rel_dirname}/${initrd}
161- else
162- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
163- fi
164- initrdfail
165+ initrd ${rel_dirname}/${initrd}
166+ else
167+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
168+ fi
169+ initrdfail
170 EOF
171 else
172 # We don't have initrd or we don't want to set PARTUUID. Don't try initrd-less boot with fallback.
173 sed "s/^/$submenu_indentation/" << EOF
174- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
175+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
176 EOF
177 if test -n "${initrd}"; then
178 # We do have initrd - let's use it at boot.
179 # TRANSLATORS: ramdisk isn't identifier. Should be translated.
180 if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
181- message="$(gettext_printf "Loading initial ramdisk ...")"
182 sed "s/^/$submenu_indentation/" << EOF
183- echo '$(echo "$message" | grub_quote)'
184+ echo '$(echo "$message" | grub_quote)'
185 EOF
186 fi
187 sed "s/^/$submenu_indentation/" << EOF
188- initrd ${rel_dirname}/${initrd}
189+ initrd ${rel_dirname}/${initrd}
190 EOF
191 fi
192 fi

Subscribers

People subscribed via source and target branches