2018-07-12 14:56:34 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-06-16 19:31:32 +00:00
|
|
|
From: Michael Chang <mchang@suse.com>
|
|
|
|
Date: Thu, 21 Aug 2014 03:39:11 +0000
|
2018-07-10 18:39:10 +00:00
|
|
|
Subject: [PATCH] grub2-btrfs-05-grub2-mkconfig
|
2017-06-16 19:31:32 +00:00
|
|
|
|
2019-07-16 09:23:51 +00:00
|
|
|
Signed-off-by: Michael Chang <mchang@suse.com>
|
2017-06-16 19:31:32 +00:00
|
|
|
---
|
|
|
|
util/grub-mkconfig.in | 3 ++-
|
|
|
|
util/grub-mkconfig_lib.in | 4 ++++
|
2019-07-17 12:15:22 +00:00
|
|
|
util/grub.d/00_header.in | 25 ++++++++++++++++++++++++-
|
2017-06-16 19:31:32 +00:00
|
|
|
util/grub.d/10_linux.in | 4 ++++
|
|
|
|
util/grub.d/20_linux_xen.in | 4 ++++
|
2019-07-17 12:15:22 +00:00
|
|
|
5 files changed, 38 insertions(+), 2 deletions(-)
|
2017-06-16 19:31:32 +00:00
|
|
|
|
|
|
|
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
2024-08-01 23:56:47 +00:00
|
|
|
index 28e92515795..884e4d363ca 100644
|
2017-06-16 19:31:32 +00:00
|
|
|
--- a/util/grub-mkconfig.in
|
|
|
|
+++ b/util/grub-mkconfig.in
|
2024-08-01 23:56:47 +00:00
|
|
|
@@ -256,7 +256,8 @@ export GRUB_DEFAULT \
|
2017-06-16 19:31:32 +00:00
|
|
|
GRUB_BADRAM \
|
|
|
|
GRUB_OS_PROBER_SKIP_LIST \
|
|
|
|
GRUB_DISABLE_SUBMENU \
|
|
|
|
- GRUB_DEFAULT_DTB
|
|
|
|
+ GRUB_DEFAULT_DTB \
|
|
|
|
+ SUSE_BTRFS_SNAPSHOT_BOOTING
|
|
|
|
|
|
|
|
if test "x${grub_cfg}" != "x"; then
|
|
|
|
rm -f "${grub_cfg}.new"
|
|
|
|
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
2024-08-01 23:56:47 +00:00
|
|
|
index 33e1750aebb..0ba0e0e1c65 100644
|
2017-06-16 19:31:32 +00:00
|
|
|
--- a/util/grub-mkconfig_lib.in
|
|
|
|
+++ b/util/grub-mkconfig_lib.in
|
2022-11-01 17:28:58 +00:00
|
|
|
@@ -49,7 +49,11 @@ grub_warn ()
|
2017-06-16 19:31:32 +00:00
|
|
|
|
|
|
|
make_system_path_relative_to_its_root ()
|
|
|
|
{
|
|
|
|
+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] ; then
|
|
|
|
+ "${grub_mkrelpath}" -r "$1"
|
|
|
|
+ else
|
|
|
|
"${grub_mkrelpath}" "$1"
|
|
|
|
+ fi
|
|
|
|
}
|
|
|
|
|
|
|
|
is_path_readable_by_grub ()
|
|
|
|
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
2024-08-01 23:56:47 +00:00
|
|
|
index c2d8b093762..3e1b77265db 100644
|
2017-06-16 19:31:32 +00:00
|
|
|
--- a/util/grub.d/00_header.in
|
|
|
|
+++ b/util/grub.d/00_header.in
|
|
|
|
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
|
|
|
|
|
|
|
|
. "$pkgdatadir/grub-mkconfig_lib"
|
|
|
|
|
|
|
|
+if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
|
|
|
|
+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then
|
|
|
|
+ cat <<EOF
|
|
|
|
+set btrfs_relative_path="y"
|
|
|
|
+export btrfs_relative_path
|
|
|
|
+EOF
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
# Do this as early as possible, since other commands might depend on it.
|
|
|
|
# (e.g. the `loadfont' command might need lvm or raid modules)
|
|
|
|
for i in ${GRUB_PRELOAD_MODULES} ; do
|
|
|
|
@@ -45,7 +53,9 @@ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT
|
|
|
|
cat << EOF
|
|
|
|
set pager=1
|
|
|
|
|
|
|
|
-if [ -s \$prefix/grubenv ]; then
|
|
|
|
+if [ -f \${config_directory}/grubenv ]; then
|
|
|
|
+ load_env -f \${config_directory}/grubenv
|
|
|
|
+elif [ -s \$prefix/grubenv ]; then
|
|
|
|
load_env
|
|
|
|
fi
|
|
|
|
EOF
|
2019-07-17 12:15:22 +00:00
|
|
|
@@ -356,3 +366,16 @@ fi
|
|
|
|
if [ "x${GRUB_BADRAM}" != "x" ] ; then
|
|
|
|
echo "badram ${GRUB_BADRAM}"
|
|
|
|
fi
|
|
|
|
+
|
|
|
|
+if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
|
|
|
|
+ [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ] &&
|
|
|
|
+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then
|
|
|
|
+ # Note: No $snapshot_num on *read-only* rollback! (bsc#901487)
|
|
|
|
+ cat <<EOF
|
|
|
|
+if [ -n "\$extra_cmdline" ]; then
|
|
|
|
+ submenu "Bootable snapshot #\$snapshot_num" {
|
|
|
|
+ menuentry "If OK, run 'snapper rollback' and reboot." { true; }
|
|
|
|
+ }
|
|
|
|
+fi
|
|
|
|
+EOF
|
|
|
|
+fi
|
2017-06-16 19:31:32 +00:00
|
|
|
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
2024-08-01 23:56:47 +00:00
|
|
|
index e8ab4082f87..48ff32c1da4 100644
|
2017-06-16 19:31:32 +00:00
|
|
|
--- a/util/grub.d/10_linux.in
|
|
|
|
+++ b/util/grub.d/10_linux.in
|
2024-08-01 23:56:47 +00:00
|
|
|
@@ -68,10 +68,14 @@ fi
|
2017-06-16 19:31:32 +00:00
|
|
|
|
|
|
|
case x"$GRUB_FS" in
|
|
|
|
xbtrfs)
|
|
|
|
+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then
|
|
|
|
+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}"
|
|
|
|
+ else
|
|
|
|
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
|
|
rootsubvol="${rootsubvol#/}"
|
|
|
|
if [ "x${rootsubvol}" != x ]; then
|
|
|
|
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
|
|
|
+ fi
|
|
|
|
fi;;
|
|
|
|
xzfs)
|
|
|
|
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
|
|
|
|
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
2024-08-01 23:56:47 +00:00
|
|
|
index 98ee5bc58dc..efcded0fbb4 100644
|
2017-06-16 19:31:32 +00:00
|
|
|
--- a/util/grub.d/20_linux_xen.in
|
|
|
|
+++ b/util/grub.d/20_linux_xen.in
|
2024-08-01 23:56:47 +00:00
|
|
|
@@ -75,10 +75,14 @@ fi
|
2017-06-16 19:31:32 +00:00
|
|
|
|
|
|
|
case x"$GRUB_FS" in
|
|
|
|
xbtrfs)
|
|
|
|
+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then
|
|
|
|
+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}"
|
|
|
|
+ else
|
|
|
|
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
|
|
rootsubvol="${rootsubvol#/}"
|
|
|
|
if [ "x${rootsubvol}" != x ]; then
|
|
|
|
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
|
|
|
+ fi
|
|
|
|
fi;;
|
|
|
|
xzfs)
|
|
|
|
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
|