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

6b3c76
From 204d0616ba497656d21e65f1b26561c539ea1a21 Mon Sep 17 00:00:00 2001
a85e8e
From: Peter Jones <pjones@redhat.com>
a85e8e
Date: Tue, 28 Apr 2015 11:15:03 -0400
6b3c76
Subject: [PATCH 176/261] Make grub2-mkconfig construct titles that look like
6b3c76
 the ones 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
6b3c76
index e8088a181..b3c460cb2 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
6b3c76
-- 
6b3c76
2.13.5
6b3c76