c78952
From 7a7644507e4d953ea8f8d1d7133622a72a2168f5 Mon Sep 17 00:00:00 2001
bc092b
From: Peter Jones <pjones@redhat.com>
bc092b
Date: Tue, 28 Apr 2015 11:15:03 -0400
31cddd
Subject: [PATCH] Make grub2-mkconfig construct titles that look like
bc092b
 the ones we want elsewhere.
bc092b
bc092b
Resolves: rhbz#1215839
bc092b
bc092b
Signed-off-by: Peter Jones <pjones@redhat.com>
bc092b
---
ec4acb
 util/grub.d/10_linux.in | 32 ++++++++++++++++++++++----------
ec4acb
 1 file changed, 22 insertions(+), 10 deletions(-)
bc092b
bc092b
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
ec4acb
index 1215241859b..584ad1f4639 100644
bc092b
--- a/util/grub.d/10_linux.in
bc092b
+++ b/util/grub.d/10_linux.in
6f1e3d
@@ -70,11 +70,28 @@ esac
bc092b
 
6f1e3d
 mktitle ()
6f1e3d
 {
6f1e3d
-  local OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})"
6f1e3d
-  local OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})"
bc092b
+  local title_type
bc092b
+  local version
bc092b
+  local OS_NAME
bc092b
+  local OS_VERS
ec4acb
 
ec4acb
-  local titlestr="${OS_NAME} (%s) ${OS_VERS}"
ec4acb
-  echo -n ${titlestr}
bc092b
+  title_type=$1 && shift
bc092b
+  version=$1 && shift
bc092b
+
bc092b
+  OS_NAME="$(eval $(grep ^NAME= /etc/os-release) ; echo ${NAME})"
bc092b
+  OS_VERS="$(eval $(grep ^VERSION= /etc/os-release) ; echo ${VERSION})"
bc092b
+
bc092b
+  case $title_type in
bc092b
+    recovery)
bc092b
+      title=$(printf '%s (%s) %s (recovery mode)' \
bc092b
+                     "${OS_NAME}" "${version}" "${OS_VERS}")
bc092b
+      ;;
bc092b
+    *)
bc092b
+      title=$(printf '%s (%s) %s' \
bc092b
+                     "${OS_NAME}" "${version}" "${OS_VERS}")
bc092b
+      ;;
bc092b
+  esac
bc092b
+  echo -n ${title}
6f1e3d
 }
da63b3
 
6f1e3d
 title_correction_code=
6f1e3d
@@ -105,12 +122,7 @@ linux_entry ()
bc092b
       boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
bc092b
   fi
bc092b
   if [ x$type != xsimple ] ; then
bc092b
-      case $type in
bc092b
-	  recovery)
6f1e3d
-	      title="$(printf "$(mktitle) (recovery mode)" "${version}")" ;;
bc092b
-	  *)
6f1e3d
-	      title="$(printf "$(mktitle)" "${version}")" ;;
bc092b
-      esac
bc092b
+      title=$(mktitle "$type" "$version")
bc092b
       if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
bc092b
 	  replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
bc092b
 	  quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"