Apply Ubuntu GRUB Legacy changes to legacy update-grub script.

This commit is contained in:
Colin Watson 2013-01-29 05:59:09 +00:00
parent 55f01c0ae1
commit 3bb94bbbf1
3 changed files with 126 additions and 0 deletions

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ grub2 (2.00-13) UNRELEASED; urgency=low
- Output a menu entry for firmware setup on UEFI FastBoot systems.
- Set a monochromatic theme and an appropriate background for Ubuntu.
- Remove "GNU/Linux" from default distributor string for Ubuntu.
- Apply Ubuntu GRUB Legacy changes to legacy update-grub script.
-- Colin Watson <cjwatson@debian.org> Mon, 28 Jan 2013 11:08:07 +0000

119
debian/legacy/update-grub.ubuntu.patch vendored Normal file
View File

@ -0,0 +1,119 @@
--- update-grub.orig 2011-03-17 14:32:24.000000000 +0000
+++ update-grub 2012-09-06 22:38:51.498737000 +0100
@@ -218,7 +218,7 @@
kopt="root=$linux_root_device ro"
# Title
-title="Debian GNU/`uname -s | sed -e s,GNU/,,g`"
+title=$(lsb_release --short --description 2>/dev/null) || title="Ubuntu"
# should update-grub remember the default entry
updatedefaultentry="false"
@@ -235,7 +235,7 @@
# additional options to use with the default boot option, but not with the
# alternatives
- defoptions=""
+ defoptions="quiet splash"
# should grub lock the old kernels
lockold="false"
@@ -247,7 +247,7 @@
xenkopt="console=tty0"
# options to use with the alternative boot options
- altoptions="(single-user mode) single"
+ altoptions="(recovery mode) single"
# controls howmany kernels are listed in the config file,
# this does not include the alternative kernels
@@ -262,6 +262,13 @@
# stores the command line arguments
command_line_arguments=$1
+# does this version of grub support the quiet option?
+if [ -f ${grub_dir}/installed-version ] && dpkg --compare-versions `cat ${grub_dir}/installed-version` ge 0.97-11ubuntu4; then
+ supports_quiet=true
+else
+ supports_quiet=false
+fi
+
# read user configuration
if test -f "/etc/default/grub" ; then
. /etc/default/grub
@@ -504,6 +511,12 @@
local hypervisor_options; hypervisor_options=$1; shift
fi
+ local grub_root_type
+ case "$grub_root_device" in
+ [^A-Za-z0-9]*) grub_root_type='root' ;;
+ *) grub_root_type='uuid' ;;
+ esac
+
echo -n "title " >> $buffer
if [ -n "$hypervisor" ]; then
@@ -512,7 +525,12 @@
echo -n "$title" >> $buffer
if [ -n "$kernel_version" ]; then
- echo -n ", kernel $kernel_version" >> $buffer
+ echo -n ", " >> $buffer
+ # memtest86 is not strictly a kernel
+ if ! echo "$kernel_version" | grep -q ^memtest86; then
+ echo -n "kernel " >> $buffer
+ fi
+ echo -n "$kernel_version" >> $buffer
fi
if [ -n "$recovery_desc" ]; then
echo -n " $recovery_desc" >> $buffer
@@ -528,7 +546,7 @@
echo "lock" >> $buffer
fi
- echo "root $grub_root_device" >> $buffer
+ echo "$grub_root_type $grub_root_device" >> $buffer
echo -n "kernel " >> $buffer
if [ -n "$hypervisor" ]; then
@@ -557,6 +575,10 @@
echo "$initrd" >> $buffer
fi
+ if [ ! -n "$recovery_desc" -a x"$supports_quiet" = x"true" ]; then
+ echo "quiet" >> $buffer
+ fi
+
if test x"$savedefault" = x"true" ; then
echo "savedefault" >> $buffer
fi
@@ -701,7 +723,7 @@
echo "## altoption boot targets option" >> $buffer
echo "## multiple altoptions lines are allowed" >> $buffer
echo "## e.g. altoptions=(extra menu suffix) extra boot options" >> $buffer
-echo "## altoptions=(single-user) single" >> $buffer
+echo "## altoptions=(recovery) single" >> $buffer
if ! grep -q "^# altoptions" $menu ; then
echo "# altoptions=$altoptions" >> $buffer
@@ -846,13 +868,18 @@
## heres where we start writing out the kernel entries
counter=0
+case "$grub_root_device" in
+[^A-Za-z0-9]*) grub_root_type='root' ;;
+*) grub_root_type='uuid' ;;
+esac
+
grub2name="${kernel_dir}/grub/core.img"
if [ "$LET_US_TRY_GRUB_2" = "true" ] \
&& test -f /boot/grub/core.img ; then
echo "Found GRUB 2: $grub2name" >&2
cat >> $buffer << EOF
title Chainload into GRUB 2
-root $grub_root_device
+$grub_root_type $grub_root_device
kernel $grub2name
title `echo ───────────────────────────────────────────────────────────────────── | iconv -f utf-8 -t cp437`

6
debian/rules vendored
View File

@ -301,6 +301,12 @@ override_dh_install:
done
dh_install -pgrub-emu --sourcedir=debian/tmp-grub-emu
dh_install -pgrub-emu-dbg --sourcedir=debian/tmp-grub-emu
ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
ifneq (,$(filter grub-pc,$(BUILD_PACKAGES)))
patch debian/grub-pc/usr/lib/grub-legacy/update-grub \
< debian/legacy/update-grub.ubuntu.patch
endif
endif
override_dh_installdocs:
dh_installdocs -pgrub-common -pgrub-rescue-pc -pgrub-firmware-qemu -A AUTHORS NEWS README THANKS TODO