Blame SOURCES/0062-Make-grub2-mkconfig-construct-titles-that-look-like-.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Peter Jones <pjones@redhat.com>
d9d99f
Date: Tue, 28 Apr 2015 11:15:03 -0400
d9d99f
Subject: [PATCH] Make grub2-mkconfig construct titles that look like the ones
d9d99f
 we want elsewhere.
d9d99f
d9d99f
Resolves: rhbz#1215839
d9d99f
d9d99f
Signed-off-by: Peter Jones <pjones@redhat.com>
d9d99f
---
d9d99f
 util/grub.d/10_linux.in | 34 +++++++++++++++++++++++++++-------
d9d99f
 1 file changed, 27 insertions(+), 7 deletions(-)
d9d99f
d9d99f
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
d9d99f
index 43d98476b88..a8a8e2cf325 100644
d9d99f
--- a/util/grub.d/10_linux.in
d9d99f
+++ b/util/grub.d/10_linux.in
d9d99f
@@ -78,6 +78,32 @@ case x"$GRUB_FS" in
d9d99f
 	;;
d9d99f
 esac
d9d99f
 
d9d99f
+mktitle ()
d9d99f
+{
d9d99f
+  local title_type
d9d99f
+  local version
d9d99f
+  local OS_NAME
d9d99f
+  local OS_VERS
d9d99f
+
d9d99f
+  title_type=$1 && shift
d9d99f
+  version=$1 && shift
d9d99f
+
d9d99f
+  OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})"
d9d99f
+  OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})"
d9d99f
+
d9d99f
+  case $title_type in
d9d99f
+    recovery)
d9d99f
+      title=$(printf '%s (%s) %s (recovery mode)' \
d9d99f
+                     "${OS_NAME}" "${version}" "${OS_VERS}")
d9d99f
+      ;;
d9d99f
+    *)
d9d99f
+      title=$(printf '%s (%s) %s' \
d9d99f
+                     "${OS_NAME}" "${version}" "${OS_VERS}")
d9d99f
+      ;;
d9d99f
+  esac
d9d99f
+  echo -n ${title}
d9d99f
+}
d9d99f
+
d9d99f
 title_correction_code=
d9d99f
 
d9d99f
 linux_entry ()
d9d99f
@@ -91,17 +117,11 @@ linux_entry ()
d9d99f
       boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
d9d99f
   fi
d9d99f
   if [ x$type != xsimple ] ; then
d9d99f
-      case $type in
d9d99f
-	  recovery)
d9d99f
-	      title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
d9d99f
-	  *)
d9d99f
-	      title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
d9d99f
-      esac
d9d99f
+      title=$(mktitle "$type" "$version")
d9d99f
       if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
d9d99f
 	  replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
d9d99f
 	  quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
d9d99f
 	  title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
d9d99f
-	  grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
d9d99f
       fi
d9d99f
       echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
d9d99f
   else