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