nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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