On Fri, Oct 11, 2024 at 6:40 PM Leo Sandoval <lsand...@redhat.com> wrote:
>
> From: Michael Chang <mch...@suse.com>
>
> Signed-off-by: Michael Chang <mch...@suse.com>


This patch needs a real commit message. I know which series of patches
this comes from, and they *all* need real commit messages. Can you and
Michael work to figure out proper messages for these?

> ---
>  util/grub-mkconfig.in       |  3 ++-
>  util/grub-mkconfig_lib.in   |  4 ++++
>  util/grub.d/00_header.in    | 26 +++++++++++++++++++++++++-
>  util/grub.d/10_linux.in     |  4 ++++
>  util/grub.d/20_linux_xen.in |  4 ++++
>  5 files changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
> index 91f761331..ad5b778e3 100644
> --- a/util/grub-mkconfig.in
> +++ b/util/grub-mkconfig.in
> @@ -259,7 +259,8 @@ export GRUB_DEFAULT \
>    GRUB_BADRAM \
>    GRUB_OS_PROBER_SKIP_LIST \
>    GRUB_DISABLE_SUBMENU \
> -  GRUB_DEFAULT_DTB
> +  GRUB_DEFAULT_DTB \
> +  SUSE_BTRFS_SNAPSHOT_BOOTING
>

This needs to drop the SUSE_ prefix for upstreaming. Same for the
instances below.

>  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
> index 33e1750ae..0ba0e0e1c 100644
> --- a/util/grub-mkconfig_lib.in
> +++ b/util/grub-mkconfig_lib.in
> @@ -49,7 +49,11 @@ grub_warn ()
>
>  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
> index 6a316a5ba..4ed7975a9 100644
> --- a/util/grub.d/00_header.in
> +++ b/util/grub.d/00_header.in
> @@ -27,6 +27,15 @@ 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
> @@ -43,7 +52,9 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then 
> GRUB_DEFAULT_BUTTON='${saved_
>  if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then 
> GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
>
>  cat << EOF
> -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
> @@ -354,3 +365,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
> diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
> index b94af4a8d..192d7f594 100644
> --- a/util/grub.d/10_linux.in
> +++ b/util/grub.d/10_linux.in
> @@ -68,10 +68,14 @@ fi
>
>  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
> index 94dd8be13..a786c87ac 100644
> --- a/util/grub.d/20_linux_xen.in
> +++ b/util/grub.d/20_linux_xen.in
> @@ -75,10 +75,14 @@ fi
>
>  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`
> --
> 2.46.2
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



-- 
真実はいつも一つ!/ Always, there's only one truth!

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to