dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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