Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archiso/mkarchiso
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2022-06-21 20:45:48 +0300
committernl6720 <nl6720@gmail.com>2022-06-24 10:38:27 +0300
commitfda19075813c40ad88d690247e167cb57096c316 (patch)
treee2a7921516d8b843f7dd2a304104713eeebb8f06 /archiso/mkarchiso
parente654106ecf5741c5abdc591ec026104eafa118a3 (diff)
mkarchiso: work arround GRUB's cmdpath having incorect case on some firmware
Fixes #183
Diffstat (limited to 'archiso/mkarchiso')
-rwxr-xr-xarchiso/mkarchiso26
1 files changed, 22 insertions, 4 deletions
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index bb0524c..0c6a1ea 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -536,8 +536,17 @@ _make_bootmode_uefi-ia32.grub.esp() {
s|%ARCH%|${arch}|g" \
"${profile}/grub/grub.cfg" > "${work_dir}/grub.cfg"
- # shellcheck disable=SC2016
- printf 'configfile ${cmdpath}/grub.cfg\n' > "${work_dir}/grub-embed.cfg"
+ IFS='' read -r -d '' grubembedcfg <<'EOF' || true
+if ! [ -d "$cmdpath" ]; then
+ # On some firmware, GRUB has a wrong cmdpath when booted from an optical disc.
+ # https://gitlab.archlinux.org/archlinux/archiso/-/issues/183
+ if regexp --set=1:isodevice '^(\([^)]+\))\/?[Ee][Ff][Ii]\/[Bb][Oo][Oo][Tt]\/?$' "$cmdpath"; then
+ cmdpath="${isodevice}/EFI/BOOT"
+ fi
+fi
+configfile "${cmdpath}/grub.cfg"
+EOF
+ printf '%s\n' "$grubembedcfg" > "${work_dir}/grub-embed.cfg"
# Create EFI binary
grub-mkstandalone -O i386-efi \
@@ -612,8 +621,17 @@ _make_bootmode_uefi-x64.grub.esp() {
s|%ARCH%|${arch}|g" \
"${profile}/grub/grub.cfg" > "${work_dir}/grub.cfg"
- # shellcheck disable=SC2016
- printf 'configfile ${cmdpath}/grub.cfg\n' > "${work_dir}/grub-embed.cfg"
+ IFS='' read -r -d '' grubembedcfg <<'EOF' || true
+if ! [ -d "$cmdpath" ]; then
+ # On some firmware, GRUB has a wrong cmdpath when booted from an optical disc.
+ # https://gitlab.archlinux.org/archlinux/archiso/-/issues/183
+ if regexp --set=1:isodevice '^(\([^)]+\))\/?[Ee][Ff][Ii]\/[Bb][Oo][Oo][Tt]\/?$' "$cmdpath"; then
+ cmdpath="${isodevice}/EFI/BOOT"
+ fi
+fi
+configfile "${cmdpath}/grub.cfg"
+EOF
+ printf '%s\n' "$grubembedcfg" > "${work_dir}/grub-embed.cfg"
# Create EFI binary
grub-mkstandalone -O x86_64-efi \