Blame SOURCES/0056-Generate-OS-and-CLASS-in-10_linux-from-etc-os-releas.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Peter Jones <pjones@redhat.com>
8631a2
Date: Thu, 4 Sep 2014 14:23:23 -0400
8631a2
Subject: [PATCH] Generate OS and CLASS in 10_linux from /etc/os-release
8631a2
8631a2
This makes us use pretty names in the titles we generate in
8631a2
grub2-mkconfig when GRUB_DISTRIBUTOR isn't set.
8631a2
8631a2
Resolves: rhbz#996794
8631a2
8631a2
Signed-off-by: Peter Jones <pjones@redhat.com>
8631a2
---
8631a2
 util/grub.d/10_linux.in | 3 ++-
8631a2
 1 file changed, 2 insertions(+), 1 deletion(-)
8631a2
8631a2
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
f6e916
index b744438e0..43d98476b 100644
8631a2
--- a/util/grub.d/10_linux.in
8631a2
+++ b/util/grub.d/10_linux.in
8631a2
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"
8631a2
 CLASS="--class gnu-linux --class gnu --class os --unrestricted"
8631a2
 
8631a2
 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
8631a2
-  OS="$(sed 's, release .*$,,g' /etc/system-release)"
8631a2
+  OS="$(eval $(grep PRETTY_NAME /etc/os-release) ; echo ${PRETTY_NAME})"
8631a2
+  CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}"
8631a2
 else
8631a2
   OS="${GRUB_DISTRIBUTOR}"
8631a2
   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"