]> git.proxmox.com Git - grub2.git/commitdiff
Apply Ubuntu GRUB Legacy changes to legacy update-grub script.
authorColin Watson <cjwatson@canonical.com>
Tue, 29 Jan 2013 05:59:09 +0000 (05:59 +0000)
committerColin Watson <cjwatson@canonical.com>
Tue, 29 Jan 2013 05:59:09 +0000 (05:59 +0000)
debian/changelog
debian/legacy/update-grub.ubuntu.patch [new file with mode: 0644]
debian/rules

index 7587b1e2031645ac7391a5288045a651eb89c80f..bd534207e495a1add414b177a03376841c88f1ff 100644 (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
 
diff --git a/debian/legacy/update-grub.ubuntu.patch b/debian/legacy/update-grub.ubuntu.patch
new file mode 100644 (file)
index 0000000..6566002
--- /dev/null
@@ -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`
index a37b85c83c8cc0ee8a1750171bf00ba1d7d55522..e4f7898283f732d3a75371697b3534d45b6d497b 100755 (executable)
@@ -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