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 <