forked from pool/grub2
b05b350108
- snapper rollback support (fate#317062) * add btrfs_follow_default.patch * add suse_btrfs_grub2_install.sh * add 80_suse_btrfs_snapshot * refresh grub2-snapper-plugin.sh - add grub2-x86_64-xen subpackage (bnc#863821) - ieee1275: check for IBM pseries emulated machine (bnc#869964) - added patches: * grub2-ppc64-build-ppc64-32bit.patch - Build ppc64 as 32bit - added patches: * grub2-ppc64-build-ppc64-32bit.patch - Rename PowerPC patches so it will have architecture in it's name - added patches: * grub2-ppc64le-01-Add-Little-Endian-support-for-Power64-to-the-build.patch * grub2-ppc64le-02-Build-grub-as-O1-until-we-add-savegpr-and-restgpr-ro.patch * grub2-ppc64le-03-disable-creation-of-vsx-and-altivec-instructions.patch * grub2-ppc64le-04-powerpc64-LE-s-linker-knows-how-to-handle-the-undefi.patch * grub2-ppc64le-05-grub-install-can-now-recognize-and-install-a-LE-grub.patch * grub2-ppc64le-06-set-the-ABI-version-to-0x02-in-the-e_flag-of-the-PPC.patch * grub2-ppc64le-07-Add-IEEE1275_ADDR-helper.patch * grub2-ppc64le-08-Fix-some-more-warnings-when-casting.patch * grub2-ppc64le-09-Add-powerpc64-types.patch * grub2-ppc64le-10-powerpc64-is-not-necessarily-BigEndian-anymore.patch * grub2-ppc64le-11-Fix-warnings-when-building-powerpc-linux-loader-64bi.patch * grub2-ppc64le-12-GRUB_ELF_R_PPC_-processing-is-applicable-only-for-32.patch OBS-URL: https://build.opensuse.org/request/show/228323 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=81
124 lines
4.5 KiB
Diff
124 lines
4.5 KiB
Diff
From: Michael Chang <mchang@suse.com>
|
|
Subject: provide overridable root by subvol
|
|
|
|
References: fate#316522, fate#316232
|
|
Patch-Mainline: no
|
|
|
|
This patch provides a environment variable $subvol that can be used
|
|
to override path relative to absolute root by specific $subvol.
|
|
|
|
v1:
|
|
Introduce $boot_prefix for setting prefix on seeking other /boot
|
|
directory.
|
|
|
|
v2:
|
|
Refresh for s390x-emu.
|
|
|
|
Signed-off-by: Michael Chang <mchang@suse.com>
|
|
|
|
---
|
|
util/grub.d/10_linux.in | 57 ++++++++++++++++++++++++++++++++++++++++--------
|
|
1 file changed, 48 insertions(+), 9 deletions(-)
|
|
|
|
--- a/util/grub.d/10_linux.in
|
|
+++ b/util/grub.d/10_linux.in
|
|
@@ -55,7 +55,9 @@ case x"$GRUB_FS" in
|
|
xbtrfs)
|
|
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
rootsubvol="${rootsubvol#/}"
|
|
- if [ "x${rootsubvol}" != x ]; then
|
|
+ if [ "x$overridable_root_by_subvol" = "xtrue" ]; then
|
|
+ GRUB_CMDLINE_LINUX="\${rootflags} ${GRUB_CMDLINE_LINUX}"
|
|
+ elif [ "x${rootsubvol}" != x ]; then
|
|
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
|
fi;;
|
|
xzfs)
|
|
@@ -145,17 +147,43 @@ linux_entry ()
|
|
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
|
fi
|
|
fi
|
|
+
|
|
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
|
|
+ sed "s/^/$submenu_indentation/" << EOF
|
|
+ if [ "x\$subvol" = "x" ]; then
|
|
+ bootdir="${rel_dirname}"
|
|
+ rootdir="${rootsubvol}"
|
|
+ else
|
|
+ bootdir="\${subvol}${dirname}"
|
|
+ rootdir="\${subvol}"
|
|
+ fi
|
|
+ if [ "x\${rootdir}" != "x" ]; then
|
|
+ rootflags="rootflags=subvol=\${rootdir}"
|
|
+ else
|
|
+ rootflags=""
|
|
+ fi
|
|
+EOF
|
|
+ fi
|
|
+
|
|
message="$(gettext_printf "Loading Linux %s ..." ${version})"
|
|
if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then
|
|
sed "s/^/$submenu_indentation/" << EOF
|
|
echo '$message'
|
|
- linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
|
EOF
|
|
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
|
|
+ echo " linuxefi \${bootdir}/${basename} root=${linux_root_device_thisversion} ro ${args}" | sed "s/^/$submenu_indentation/"
|
|
+ else
|
|
+ echo " linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}" | sed "s/^/$submenu_indentation/"
|
|
+ fi
|
|
else
|
|
sed "s/^/$submenu_indentation/" << EOF
|
|
echo '$(echo "$message" | grub_quote)'
|
|
- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ${args}
|
|
EOF
|
|
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
|
|
+ echo " linux \${bootdir}/${basename} root=${linux_root_device_thisversion} ${args}" | sed "s/^/$submenu_indentation/"
|
|
+ else
|
|
+ echo " linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ${args}" | sed "s/^/$submenu_indentation/"
|
|
+ fi
|
|
fi
|
|
if test -n "${initrd}" ; then
|
|
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
|
@@ -163,13 +191,21 @@ EOF
|
|
if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then
|
|
sed "s/^/$submenu_indentation/" << EOF
|
|
echo '$message'
|
|
- initrdefi ${rel_dirname}/${initrd}
|
|
EOF
|
|
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
|
|
+ echo " initrdefi \${bootdir}/${initrd}" | sed "s/^/$submenu_indentation/"
|
|
+ else
|
|
+ echo " initrdefi ${rel_dirname}/${initrd}" | sed "s/^/$submenu_indentation/"
|
|
+ fi
|
|
else
|
|
sed "s/^/$submenu_indentation/" << EOF
|
|
echo '$(echo "$message" | grub_quote)'
|
|
- initrd ${rel_dirname}/${initrd}
|
|
EOF
|
|
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
|
|
+ echo " initrd \${bootdir}/${initrd}" | sed "s/^/$submenu_indentation/"
|
|
+ else
|
|
+ echo " initrd ${rel_dirname}/${initrd}" | sed "s/^/$submenu_indentation/"
|
|
+ fi
|
|
fi
|
|
fi
|
|
sed "s/^/$submenu_indentation/" << EOF
|
|
@@ -179,10 +215,13 @@ EOF
|
|
|
|
machine=`uname -m`
|
|
case "$machine" in
|
|
- i?86 | x86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;;
|
|
- s390 | s390x) klist="/boot/image-* /boot/kernel-*" ;;
|
|
- *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \
|
|
- /boot/kernel-*" ;;
|
|
+ i?86 | x86_64) klist="${boot_prefix}/boot/vmlinuz-* \
|
|
+ ${boot_prefix}/vmlinuz-* ${boot_prefix}/boot/kernel-*" ;;
|
|
+ s390 | s390x) klist="${boot_prefix}/boot/image-* \
|
|
+ ${boot_prefix}/boot/kernel-*" ;;
|
|
+ *) klist="${boot_prefix}/boot/vmlinuz-* \
|
|
+ ${boot_prefix}/boot/vmlinux-* ${boot_prefix}/vmlinuz-* \
|
|
+ ${boot_prefix}/vmlinux-* /boot/kernel-*" ;;
|
|
esac
|
|
list=`for i in $klist; do
|
|
if grub_file_is_not_garbage "$i" ; then
|