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

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