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

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