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

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