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