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

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