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

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