Accepting request 147515 from Base:System

couple of fixes

OBS-URL: https://build.opensuse.org/request/show/147515
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=54
This commit is contained in:
Stephan Kulow 2013-01-08 12:44:12 +00:00 committed by Git OBS Bridge
commit bba30a3f3f
5 changed files with 179 additions and 2 deletions

View File

@ -0,0 +1,39 @@
From: Andrey Borzenkov <arvidjaar@gmail.com>
Subject: add "(on /dev/XXX)" to top level os-prober Linux menu entries
References: bnc#796919
1. It disambiguates multiple instances of the same OS if present.
2. It allows menu entry to be skipped by another os-prober. Otherwise
it may result in endless recursion.
Index: grub-2.00/util/grub.d/30_os-prober.in
===================================================================
--- grub-2.00.orig/util/grub.d/30_os-prober.in
+++ grub-2.00/util/grub.d/30_os-prober.in
@@ -202,7 +202,7 @@ EOF
if [ "x$is_first_entry" = xtrue ]; then
cat << EOF
-menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
+menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
EOF
save_default_entry | sed -e "s/^/\t/"
printf '%s\n' "${prepare_boot_cache}"
@@ -217,7 +217,7 @@ EOF
cat << EOF
}
EOF
- echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {"
+ echo "submenu '$(gettext_printf "Advanced options for %s" "${OS} $onstr" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {"
is_first_entry=false
fi
title="${LLABEL} $onstr"
@@ -238,7 +238,7 @@ EOF
}
EOF
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
- replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
+ replacement_title="$(echo "Advanced options for ${OS} $onstr" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"

View File

@ -0,0 +1,38 @@
From: Andrey Borzenkov <arvidjaar@gmail.com>
Subject: [PATCH] fix off by one error in enumerating MSDOS partitions
References: bnc#779534
As reported in https://bugzilla.novell.com/show_bug.cgi?id=779534,
grub2 assigns incorrect partition number to extended partitions.
This is due to slightly non-standard EBR which contains single extended
partition record, but no normal partition. Due to incorrect p.number
comparison, grub2 includes it in partition numbering.
With standard EBR first entry is "true" partition that correctly
gets assigned next available number.
At the point of comparison p.number is one less than partition
number; so make correct comparison.
Actual partition chain is visible in this attachement:
http://bugzilla.novell.com/attachment.cgi?id=519076
Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
---
grub-core/partmap/msdos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: grub-2.00/grub-core/partmap/msdos.c
===================================================================
--- grub-2.00.orig/grub-core/partmap/msdos.c
+++ grub-2.00/grub-core/partmap/msdos.c
@@ -196,7 +196,7 @@ grub_partition_msdos_iterate (grub_disk_
return grub_errno;
}
}
- else if (p.number < 4)
+ else if (p.number < 3)
/* If this partition is a logical one, shouldn't increase the
partition number. */
p.number++;

View File

@ -0,0 +1,77 @@
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(-)
diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in
index 45f0ad3..5afc079 100644
--- a/util/grub.d/10_hurd.in
+++ b/util/grub.d/10_hurd.in
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU
else
OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' ${CLASS}"
fi
at_least_one=false
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
index b0e84e2..4ec8d96 100644
--- a/util/grub.d/10_kfreebsd.in
+++ b/util/grub.d/10_kfreebsd.in
@@ -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}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' --class gnu-kfreebsd --class gnu ${CLASS}"
;;
*)
OS="FreeBSD"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index b2f65c0..40f8651 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR}"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 29184c2..f1ce61e 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
--
1.7.3.4

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Jan 8 08:09:01 UTC 2013 - mchang@suse.com
- add grub2-fix-unquoted-string-in-class.patch (bnc#788322)
-------------------------------------------------------------------
Tue Jan 8 07:09:47 UTC 2013 - arvidjaar@gmail.com
- add grub2-add-device-to-os_prober-linux-menuentry.patch (bnc#796919)
-------------------------------------------------------------------
Sun Jan 6 18:54:54 UTC 2013 - arvidjaar@gmail.com
- add patch grub2-fix-enumeration-of-extended-partition.patch to
fix enumeration of extended partitions with non-standard EBR (bnc#779534)
-------------------------------------------------------------------
Fri Jan 4 10:29:58 UTC 2013 - arvidjaar@gmail.com

View File

@ -1,7 +1,7 @@
#
# spec file for package grub2
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -132,6 +132,9 @@ Patch22: grub2-secureboot-use-linuxefi-on-uefi.patch
Patch23: grub2-secureboot-no-insmod-on-sb.patch
Patch24: grub2-secureboot-provide-linuxefi-config.patch
Patch25: 30_os-prober_UEFI_support.patch
Patch26: grub2-fix-enumeration-of-extended-partition.patch
Patch27: grub2-add-device-to-os_prober-linux-menuentry.patch
Patch28: grub2-fix-unquoted-string-in-class.patch
PreReq: perl-Bootloader
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140
@ -244,6 +247,9 @@ mv docs/grub.texi docs/grub2.texi
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
cd ..
# README.openSUSE
@ -418,7 +424,6 @@ elif [ "x${LOADER_TYPE}" = "xgrub2" ]; then
fi
%endif
%ifarch %{efi}
%triggerpostun -- %{name}-efi
@ -617,3 +622,5 @@ fi
%{_libdir}/%{name}/%{grubefiarch}/kernel.exec
%{_libdir}/%{name}/%{grubefiarch}/modinfo.sh
%endif
%changelog