updated on Sun Jan 15 00:02:00 UTC 2012
[aur-mirror.git] / grub2-efi-ubuntu / ubuntu_quick_boot.patch
blob83edb63d6e93f816cf4aca9d4ef8b11c7b07100b
1 Description: Bypass menu unless other OSes are installed or Shift is pressed
2 If other operating systems are installed, then automatically unhide the
3 menu. Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus if
4 available to check whether Shift is pressed. If it is, show the menu,
5 otherwise boot immediately. If keystatus is not available, then fall back
6 to a short delay interruptible with Escape.
8 This may or may not remain Ubuntu-specific, although it's not obviously
9 wanted upstream. It implements a requirement of
10 https://wiki.ubuntu.com/DesktopExperienceTeam/KarmicBootExperienceDesignSpec#Bootloader.
11 Author: Colin Watson <cjwatson@ubuntu.com>
12 Forwarded: no
13 Last-Update: 2011-01-05
15 Index: b/util/grub.d/00_header.in
16 ===================================================================
17 --- a/util/grub.d/00_header.in
18 +++ b/util/grub.d/00_header.in
19 @@ -225,22 +225,9 @@
21 make_timeout ()
23 - if [ "x${1}" != "x" ] ; then
24 - if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
25 - verbose=
26 - else
27 - verbose=" --verbose"
28 - fi
29 - cat << EOF
30 -if sleep$verbose --interruptible ${1} ; then
31 - set timeout=${2}
32 -fi
33 -EOF
34 - else
35 - cat << EOF
36 + cat << EOF
37 set timeout=${2}
38 EOF
39 - fi
42 if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
43 Index: b/util/grub.d/30_os-prober.in
44 ===================================================================
45 --- a/util/grub.d/30_os-prober.in
46 +++ b/util/grub.d/30_os-prober.in
47 @@ -23,22 +23,80 @@
49 . ${libdir}/grub/grub-mkconfig_lib
51 +found_other_os=
53 +make_timeout () {
54 + if [ "x${found_other_os}" = "x" ] ; then
55 + if [ "x${1}" != "x" ] ; then
56 + if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
57 + verbose=
58 + else
59 + verbose=" --verbose"
60 + fi
62 + if [ "x${1}" = "x0" ] ; then
63 + cat <<EOF
64 +if [ "x\${timeout}" != "x-1" ]; then
65 + if keystatus; then
66 + if keystatus --shift; then
67 + set timeout=-1
68 + else
69 + set timeout=0
70 + fi
71 + else
72 + if sleep$verbose --interruptible 3 ; then
73 + set timeout=0
74 + fi
75 + fi
76 +fi
77 +EOF
78 + else
79 + cat << EOF
80 +if [ "x\${timeout}" != "x-1" ]; then
81 + if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
82 + set timeout=0
83 + fi
84 +fi
85 +EOF
86 + fi
87 + fi
88 + fi
91 +adjust_timeout () {
92 + if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
93 + cat <<EOF
94 +if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
95 +EOF
96 + make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
97 + echo else
98 + make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
99 + echo fi
100 + else
101 + make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
102 + fi
105 if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
106 + adjust_timeout
107 exit 0
110 if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
111 # missing os-prober and/or linux-boot-prober
112 + adjust_timeout
113 exit 0
116 OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
117 if [ -z "${OSPROBED}" ] ; then
118 # empty os-prober output, nothing doing
119 + adjust_timeout
120 exit 0
123 osx_entry() {
124 + found_other_os=1
125 cat << EOF
126 menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" --class osx --class darwin --class os {
128 @@ -104,6 +162,7 @@
129 case ${BOOT} in
130 chain)
132 + found_other_os=1
133 cat << EOF
134 menuentry "${LONGNAME} (on ${DEVICE})" --class windows --class os {
136 @@ -146,6 +205,7 @@
137 LINITRD="${LINITRD#/boot}"
140 + found_other_os=1
141 cat << EOF
142 menuentry "${LLABEL} (on ${DEVICE})" --class gnu-linux --class gnu --class os {
144 @@ -173,6 +233,7 @@
145 osx_entry xnu_kernel64 64
147 hurd)
148 + found_other_os=1
149 cat << EOF
150 menuentry "${LONGNAME} (on ${DEVICE})" --class hurd --class gnu --class os {
152 @@ -202,3 +263,5 @@
154 esac
155 done
157 +adjust_timeout