dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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