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

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