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

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