nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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