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

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