dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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