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

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