Merge ~mwhudson/grub-installer:lp-1847721 into ~ubuntu-installer/grub-installer:master

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: a3449b18f5760fea8fb34a1dd343539a34a0463a
Proposed branch: ~mwhudson/grub-installer:lp-1847721
Merge into: ~ubuntu-installer/grub-installer:master
Diff against target: 60 lines (+11/-12)
1 file modified
grub-installer (+11/-12)
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+385963@code.launchpad.net

This proposal supersedes a proposal from 2020-06-17.

Description of the change

allow invoker to override architecture and some tweaks to make installing grub for UEFI when legacy booted work

retargeted version of https://code.launchpad.net/~mwhudson/ubuntu/+source/grub-installer/+git/grub-installer/+merge/384068

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/grub-installer b/grub-installer
2index 8879dbe..2329f0e 100755
3--- a/grub-installer
4+++ b/grub-installer
5@@ -8,11 +8,16 @@ set -e
6 if [ "$1" ]; then
7 ROOT="$1"
8 chroot=chroot
9+ shift
10 else
11 ROOT=
12 chroot=
13 fi
14
15+if [ "$1" ]; then
16+ ARCH="$1"
17+fi
18+
19 . /usr/share/grub-installer/functions.sh
20 . /usr/share/grub-installer/otheros.sh
21
22@@ -37,7 +42,7 @@ debug () {
23 [ -z "${DEBCONF_DEBUG}" ] || log "debug: $@"
24 }
25
26-ARCH="$(archdetect)"
27+ARCH="${ARCH:-$(archdetect)}"
28 info "architecture: $ARCH"
29
30 umount_dirs=
31@@ -494,17 +499,7 @@ case $ARCH in
32 if [ -f /var/lib/partman/ignore_uefi ]; then
33 grub_package="grub-pc"
34 else
35- grub_package="grub-efi"
36- # Override the package choice if we can figure out the
37- # right package to use directly
38- if [ -f /sys/firmware/efi/fw_platform_size ] ; then
39- SIZE=$(cat /sys/firmware/efi/fw_platform_size)
40- if [ $SIZE -eq 64 ] ; then
41- grub_package="grub-efi-amd64-signed"
42- elif [ $SIZE -eq 32 ] ; then
43- grub_package="grub-efi-ia32"
44- fi
45- fi
46+ grub_package="grub-efi-amd64-signed"
47 if [ ! -d /target/boot/efi ]; then
48 # No EFI System Partition, so presumably the partitioner
49 # believed this to be unnecessary, perhaps because we're
50@@ -1094,6 +1089,10 @@ EOF
51 grub_install_params="$grub_install_params --force"
52 fi
53
54+ if [ "$ARCH" = "amd64/efi" ] ; then
55+ grub_install_params="$grub_install_params --target x86_64-efi"
56+ fi
57+
58 CODE=0
59 case $ARCH:$grub_package in
60 *:grub|*:grub-pc|*:grub-efi*|sparc:grub-ieee1275|ppc64el/*:grub-ieee1275)

Subscribers

People subscribed via source and target branches