2013-01-08 13:44:12 +01:00
|
|
|
From 7c8906e0f3827322469655bb013247f7ce60fcd9 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Michael Chang <mchang@suse.com>
|
|
|
|
Date: Tue, 4 Dec 2012 15:24:43 +0800
|
|
|
|
Subject: [PATCH] Fix unquoted string in --class
|
|
|
|
|
|
|
|
References: bnc#788322
|
|
|
|
Patch-Mainline: no
|
|
|
|
|
|
|
|
If GRUB_DISTRIBUTOR contains special character such as '$', it would
|
|
|
|
lead to syntax error by the grub2-script-check even though user
|
|
|
|
correctly quote them in single quotes.
|
|
|
|
|
|
|
|
The cause is that grub2 scripts use not quote the strings from
|
|
|
|
GRUB_DISTRIBUTOR in --class options thus keywords interpreted by the
|
|
|
|
script parser. The fix is to add single quote to the string.
|
|
|
|
---
|
|
|
|
util/grub.d/10_hurd.in | 2 +-
|
|
|
|
util/grub.d/10_kfreebsd.in | 2 +-
|
|
|
|
util/grub.d/10_linux.in | 2 +-
|
|
|
|
util/grub.d/20_linux_xen.in | 2 +-
|
|
|
|
4 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
|
2013-02-21 15:32:16 +01:00
|
|
|
Index: grub-2.00/util/grub.d/10_hurd.in
|
|
|
|
===================================================================
|
|
|
|
--- grub-2.00.orig/util/grub.d/10_hurd.in
|
|
|
|
+++ grub-2.00/util/grub.d/10_hurd.in
|
|
|
|
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; th
|
2013-01-08 13:44:12 +01:00
|
|
|
OS=GNU
|
|
|
|
else
|
|
|
|
OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
|
|
|
|
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
|
2013-02-21 15:32:16 +01:00
|
|
|
+ CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' ${CLASS}"
|
2013-01-08 13:44:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
at_least_one=false
|
2013-02-21 15:32:16 +01:00
|
|
|
Index: grub-2.00/util/grub.d/10_kfreebsd.in
|
|
|
|
===================================================================
|
|
|
|
--- grub-2.00.orig/util/grub.d/10_kfreebsd.in
|
|
|
|
+++ grub-2.00/util/grub.d/10_kfreebsd.in
|
2013-01-08 13:44:12 +01:00
|
|
|
@@ -30,7 +30,7 @@ CLASS="--class os"
|
|
|
|
case "${GRUB_DISTRIBUTOR}" in
|
|
|
|
Debian)
|
|
|
|
OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD"
|
|
|
|
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) --class gnu-kfreebsd --class gnu ${CLASS}"
|
2013-02-21 15:32:16 +01:00
|
|
|
+ CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' --class gnu-kfreebsd --class gnu ${CLASS}"
|
2013-01-08 13:44:12 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
OS="FreeBSD"
|
2013-02-21 15:32:16 +01:00
|
|
|
Index: grub-2.00/util/grub.d/10_linux.in
|
|
|
|
===================================================================
|
|
|
|
--- grub-2.00.orig/util/grub.d/10_linux.in
|
|
|
|
+++ grub-2.00/util/grub.d/10_linux.in
|
|
|
|
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; th
|
2013-01-08 13:44:12 +01:00
|
|
|
OS=GNU/Linux
|
|
|
|
else
|
|
|
|
OS="${GRUB_DISTRIBUTOR}"
|
|
|
|
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
|
2013-02-21 15:32:16 +01:00
|
|
|
+ CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' ${CLASS}"
|
2013-01-08 13:44:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|
2013-02-21 15:32:16 +01:00
|
|
|
Index: grub-2.00/util/grub.d/20_linux_xen.in
|
|
|
|
===================================================================
|
|
|
|
--- grub-2.00.orig/util/grub.d/20_linux_xen.in
|
|
|
|
+++ grub-2.00/util/grub.d/20_linux_xen.in
|
|
|
|
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; th
|
2013-01-08 13:44:12 +01:00
|
|
|
OS=GNU/Linux
|
|
|
|
else
|
|
|
|
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
|
|
|
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
|
2013-02-21 15:32:16 +01:00
|
|
|
+ CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' ${CLASS}"
|
2013-01-08 13:44:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|