|
|
8631a2 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
8631a2 |
From: Michael Chang <mchang@suse.com>
|
|
|
8631a2 |
Date: Thu, 21 Aug 2014 03:39:11 +0000
|
|
|
8631a2 |
Subject: [PATCH] grub2-btrfs-05-grub2-mkconfig
|
|
|
8631a2 |
|
|
|
8631a2 |
---
|
|
|
8631a2 |
util/grub-mkconfig.in | 3 ++-
|
|
|
8631a2 |
util/grub-mkconfig_lib.in | 4 ++++
|
|
|
8631a2 |
util/grub.d/00_header.in | 24 +++++++++++++++++++++++-
|
|
|
8631a2 |
util/grub.d/10_linux.in | 4 ++++
|
|
|
8631a2 |
util/grub.d/20_linux_xen.in | 4 ++++
|
|
|
8631a2 |
5 files changed, 37 insertions(+), 2 deletions(-)
|
|
|
8631a2 |
|
|
|
8631a2 |
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
|
|
f6e916 |
index 8218f3d47..4248b9341 100644
|
|
|
8631a2 |
--- a/util/grub-mkconfig.in
|
|
|
8631a2 |
+++ b/util/grub-mkconfig.in
|
|
|
8631a2 |
@@ -258,7 +258,8 @@ export GRUB_DEFAULT \
|
|
|
8631a2 |
GRUB_BADRAM \
|
|
|
8631a2 |
GRUB_OS_PROBER_SKIP_LIST \
|
|
|
8631a2 |
GRUB_DISABLE_SUBMENU \
|
|
|
8631a2 |
- GRUB_DEFAULT_DTB
|
|
|
8631a2 |
+ GRUB_DEFAULT_DTB \
|
|
|
8631a2 |
+ SUSE_BTRFS_SNAPSHOT_BOOTING
|
|
|
8631a2 |
|
|
|
8631a2 |
if test "x${grub_cfg}" != "x"; then
|
|
|
8631a2 |
rm -f "${grub_cfg}.new"
|
|
|
8631a2 |
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
|
|
f6e916 |
index 113a41f94..b3aae534d 100644
|
|
|
8631a2 |
--- a/util/grub-mkconfig_lib.in
|
|
|
8631a2 |
+++ b/util/grub-mkconfig_lib.in
|
|
|
8631a2 |
@@ -52,7 +52,11 @@ grub_warn ()
|
|
|
8631a2 |
|
|
|
8631a2 |
make_system_path_relative_to_its_root ()
|
|
|
8631a2 |
{
|
|
|
8631a2 |
+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] ; then
|
|
|
8631a2 |
+ "${grub_mkrelpath}" -r "$1"
|
|
|
8631a2 |
+ else
|
|
|
8631a2 |
"${grub_mkrelpath}" "$1"
|
|
|
8631a2 |
+ fi
|
|
|
8631a2 |
}
|
|
|
8631a2 |
|
|
|
8631a2 |
is_path_readable_by_grub ()
|
|
|
8631a2 |
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
|
|
f6e916 |
index 858b526c9..e2a533001 100644
|
|
|
8631a2 |
--- a/util/grub.d/00_header.in
|
|
|
8631a2 |
+++ b/util/grub.d/00_header.in
|
|
|
8631a2 |
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
|
|
|
8631a2 |
|
|
|
8631a2 |
. "$pkgdatadir/grub-mkconfig_lib"
|
|
|
8631a2 |
|
|
|
8631a2 |
+if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
|
|
|
8631a2 |
+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then
|
|
|
8631a2 |
+ cat <
|
|
|
8631a2 |
+set btrfs_relative_path="y"
|
|
|
8631a2 |
+export btrfs_relative_path
|
|
|
8631a2 |
+EOF
|
|
|
8631a2 |
+fi
|
|
|
8631a2 |
+
|
|
|
8631a2 |
# Do this as early as possible, since other commands might depend on it.
|
|
|
8631a2 |
# (e.g. the `loadfont' command might need lvm or raid modules)
|
|
|
8631a2 |
for i in ${GRUB_PRELOAD_MODULES} ; do
|
|
|
8631a2 |
@@ -45,7 +53,9 @@ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT
|
|
|
8631a2 |
cat << EOF
|
|
|
8631a2 |
set pager=1
|
|
|
8631a2 |
|
|
|
8631a2 |
-if [ -s \$prefix/grubenv ]; then
|
|
|
8631a2 |
+if [ -f \${config_directory}/grubenv ]; then
|
|
|
8631a2 |
+ load_env -f \${config_directory}/grubenv
|
|
|
8631a2 |
+elif [ -s \$prefix/grubenv ]; then
|
|
|
8631a2 |
load_env
|
|
|
8631a2 |
fi
|
|
|
8631a2 |
EOF
|
|
|
8631a2 |
@@ -356,3 +366,15 @@ fi
|
|
|
8631a2 |
if [ "x${GRUB_BADRAM}" != "x" ] ; then
|
|
|
8631a2 |
echo "badram ${GRUB_BADRAM}"
|
|
|
8631a2 |
fi
|
|
|
8631a2 |
+
|
|
|
8631a2 |
+if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] &&
|
|
|
8631a2 |
+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then
|
|
|
8631a2 |
+ # Note: No $snapshot_num on *read-only* rollback! (bsc#901487)
|
|
|
8631a2 |
+ cat <
|
|
|
8631a2 |
+if [ -n "\$extra_cmdline" ]; then
|
|
|
8631a2 |
+ submenu "Bootable snapshot #\$snapshot_num" {
|
|
|
8631a2 |
+ menuentry "If OK, run 'snapper rollback' and reboot." { true; }
|
|
|
8631a2 |
+ }
|
|
|
8631a2 |
+fi
|
|
|
8631a2 |
+EOF
|
|
|
8631a2 |
+fi
|
|
|
8631a2 |
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
|
f6e916 |
index 4e49ccdf7..d9a05937e 100644
|
|
|
8631a2 |
--- a/util/grub.d/10_linux.in
|
|
|
8631a2 |
+++ b/util/grub.d/10_linux.in
|
|
|
8631a2 |
@@ -66,10 +66,14 @@ fi
|
|
|
8631a2 |
|
|
|
8631a2 |
case x"$GRUB_FS" in
|
|
|
8631a2 |
xbtrfs)
|
|
|
8631a2 |
+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then
|
|
|
8631a2 |
+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}"
|
|
|
8631a2 |
+ else
|
|
|
8631a2 |
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
|
8631a2 |
rootsubvol="${rootsubvol#/}"
|
|
|
8631a2 |
if [ "x${rootsubvol}" != x ]; then
|
|
|
8631a2 |
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
|
|
8631a2 |
+ fi
|
|
|
8631a2 |
fi;;
|
|
|
8631a2 |
xzfs)
|
|
|
8631a2 |
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
|
|
|
8631a2 |
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
|
|
f6e916 |
index 972a4b5a0..bcdc3ceac 100644
|
|
|
8631a2 |
--- a/util/grub.d/20_linux_xen.in
|
|
|
8631a2 |
+++ b/util/grub.d/20_linux_xen.in
|
|
|
8631a2 |
@@ -73,10 +73,14 @@ fi
|
|
|
8631a2 |
|
|
|
8631a2 |
case x"$GRUB_FS" in
|
|
|
8631a2 |
xbtrfs)
|
|
|
8631a2 |
+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then
|
|
|
8631a2 |
+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}"
|
|
|
8631a2 |
+ else
|
|
|
8631a2 |
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
|
8631a2 |
rootsubvol="${rootsubvol#/}"
|
|
|
8631a2 |
if [ "x${rootsubvol}" != x ]; then
|
|
|
8631a2 |
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
|
|
8631a2 |
+ fi
|
|
|
8631a2 |
fi;;
|
|
|
8631a2 |
xzfs)
|
|
|
8631a2 |
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
|