diff --git a/grub2-snapper-plugin.sh b/grub2-snapper-plugin.sh index 1c46327..1f371ad 100644 --- a/grub2-snapper-plugin.sh +++ b/grub2-snapper-plugin.sh @@ -62,12 +62,28 @@ snapshot_submenu () { kernel_ver=`readlink ${snapshot}/boot/image | sed -e 's/^image-//' -e 's/-default$//'` fi eval `cat ${snapshot}/etc/os-release` + + # 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 ""` + + # 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 + 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 + desc=`xmllint --xpath '/snapshot/description/text()' "${snapper_snapshot_path}/${pre_num}/info.xml" 2>/dev/null || echo ""` + fi + fi + fi + test "$important" = "yes" && important="*" || important=" " test "$stype" = "single" && stype="" - test -z "$stype" || stype=",$stype" - desc=`xmllint --xpath '/snapshot/description/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` - #test "$desc" = "timeline" && return 1 test -z "$desc" || desc=",$desc" title="${important}${NAME} $VERSION ($kernel_ver,$date$stype$desc)" diff --git a/grub2.changes b/grub2.changes index 10f1182..e560aa4 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jun 12 07:20:00 UTC 2015 - mchang@suse.com + +- 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. (fate#317972) +- Show user defined comments in grub2 menu for snapshots (fate#318101) + * modified grub2-snapper-plugin.sh + ------------------------------------------------------------------- Sun Jun 7 04:00:56 UTC 2015 - arvidjaar@gmail.com