]> git.pld-linux.org Git - packages/pm-utils.git/blob - grub2.patch
add patches from fedora (NM fix, grub2, s2both in kernel support, ...)
[packages/pm-utils.git] / grub2.patch
1 # Add support for grub2 in 01grub hook
2 diff -up pm-utils-1.4.1/pm/sleep.d/01grub.orig pm-utils-1.4.1/pm/sleep.d/01grub
3 --- pm-utils-1.4.1/pm/sleep.d/01grub.orig       2010-07-04 16:42:51.000000000 +0200
4 +++ pm-utils-1.4.1/pm/sleep.d/01grub    2011-08-22 14:11:39.460613138 +0200
5 @@ -4,7 +4,8 @@
6  
7  default_resume_kernel()
8  {
9 -        [ "$1" = "suspend" ] && return $NA
10 +       local g2reboot
11 +       [ "$1" = "suspend" ] && return $NA
12         case $(uname -m) in
13                 i?86|x86_64|athlon)
14                         ;;
15 @@ -13,14 +14,26 @@ default_resume_kernel()
16                         ;;
17         esac
18  
19 -       [ -x /sbin/grubby -a -x /sbin/grub ] || return $NA
20 +       [ -x /sbin/grubby -a \( -x /sbin/grub -o -r /etc/grub2.cfg \) ] || \
21 +               return $NA
22         [ -e "/boot/vmlinuz-$(uname -r)" ] || return 1
23 -       out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index)
24 +       out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index | \
25 +               head -n 1)
26         [ -n "${out}" ] || return 1
27         current=${out#index=}
28 -       echo "savedefault --default=${current} --once" | \
29 -               /sbin/grub --device-map=/boot/grub/device.map \
30 -               --batch --no-floppy --no-curses >/dev/null
31 +       if [ -r /etc/grub2.cfg ]; then
32 +               # to enable this functionality in grub2
33 +               # GRUB_DEFAULT=saved is needed in /etc/default/grub
34 +               # if you want to be able to by-pass the selection in the
35 +               # boot menu, also use GRUB_SAVEDEFAULT=true
36 +               g2reboot=`which grub2-reboot 2>/dev/null` || \
37 +                       g2reboot=`which grub-reboot 2>/dev/null` || return $NA
38 +               $g2reboot ${current} > /dev/null
39 +       else
40 +               echo "savedefault --default=${current} --once" | \
41 +                       /sbin/grub --device-map=/boot/grub/device.map \
42 +                       --batch --no-floppy --no-curses >/dev/null
43 +       fi
44  
45         return 0
46  }
This page took 0.133963 seconds and 3 git commands to generate.