From ffd714d7a6479fcdf16e47b0bbb6baaee1f47d2543fd5da223ebb46eab54109d Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 24 Apr 2016 09:10:29 +0000 Subject: [PATCH] Accepting request 390640 from home:michael-chang:branches:Base:System - Correct show user defined comments in menu for snapshots (bsc#956698) * modified grub2-snapper-plugin.sh OBS-URL: https://build.opensuse.org/request/show/390640 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=211 --- grub2-snapper-plugin.sh | 11 ++++++----- grub2.changes | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/grub2-snapper-plugin.sh b/grub2-snapper-plugin.sh index 8d6a543..83392b9 100644 --- a/grub2-snapper-plugin.sh +++ b/grub2-snapper-plugin.sh @@ -70,13 +70,13 @@ snapshot_submenu () { # FATE#318101 # Show user defined comments in grub2 menu for snapshots # Use userdata tag "bootloader=[user defined text]" - desc=`xmllint --xpath "/snapshot/userdata[key='bootloader']/value/text()" "${s_dir}/info.xml" 2>/dev/null || echo ""` - test -z "$desc" && desc=`xmllint --xpath '/snapshot/description/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` + full_desc=`xmllint --xpath "/snapshot/userdata[key='bootloader']/value/text()" "${s_dir}/info.xml" 2>/dev/null || echo ""` + test -z "$full_desc" && desc=`xmllint --xpath '/snapshot/description/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` # FATE#317972 # If we have a post entry and the description field is empty, # we should use the "Pre" number and add that description to the post entry. - if test -z "$desc" -a "$stype" = "post"; then + if test -z "$full_desc" -a -z "$desc" -a "$stype" = "post"; then pre_num=`xmllint --xpath '/snapshot/pre_num/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` if test -n "$pre_num"; then if test -f "${snapper_snapshot_path}/${pre_num}/info.xml" ; then @@ -89,11 +89,12 @@ snapshot_submenu () { test "$stype" = "single" && stype="" test -z "$stype" || stype=",$stype" test -z "$desc" || desc=",$desc" + test -z "$full_desc" && full_desc="$kernel_ver,$date$stype$desc" if test "${NAME}" = "SLES" -o "${NAME}" = "SLED"; then - title="${important}${NAME}${VERSION} ($kernel_ver,$date$stype$desc)" + title="${important}${NAME}${VERSION} ($full_desc)" else - title="${important}${NAME} ${VERSION} ($kernel_ver,$date$stype$desc)" + title="${important}${NAME} ${VERSION} ($full_desc)" fi cat <