nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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