mirror of
https://git.proxmox.com/git/grub2
synced 2025-08-14 12:55:37 +00:00
If building for Ubuntu, bypass menu unless other OSes are installed or Shift is pressed.
This commit is contained in:
parent
8d66ac9b8c
commit
eb0a00804d
11
configure.ac
11
configure.ac
@ -1087,6 +1087,17 @@ else
|
|||||||
fi
|
fi
|
||||||
AC_SUBST([QUIET_BOOT])
|
AC_SUBST([QUIET_BOOT])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([quick-boot],
|
||||||
|
[AS_HELP_STRING([--enable-quick-boot],
|
||||||
|
[bypass boot menu if possible (default=no)])],
|
||||||
|
[], [enable_quick_boot=no])
|
||||||
|
if test x"$enable_quick_boot" = xyes ; then
|
||||||
|
QUICK_BOOT=1
|
||||||
|
else
|
||||||
|
QUICK_BOOT=0
|
||||||
|
fi
|
||||||
|
AC_SUBST([QUICK_BOOT])
|
||||||
|
|
||||||
LIBS=""
|
LIBS=""
|
||||||
|
|
||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -15,6 +15,8 @@ grub2 (2.00-20) UNRELEASED; urgency=low
|
|||||||
partition for use (Steve Langasek).
|
partition for use (Steve Langasek).
|
||||||
- Adjust UEFI installation to cope with Kubuntu setting GRUB_DISTRIBUTOR
|
- Adjust UEFI installation to cope with Kubuntu setting GRUB_DISTRIBUTOR
|
||||||
(LP: #1242417).
|
(LP: #1242417).
|
||||||
|
- If building for Ubuntu:
|
||||||
|
+ Bypass menu unless other OSes are installed or Shift is pressed.
|
||||||
|
|
||||||
-- Colin Watson <cjwatson@debian.org> Mon, 07 Oct 2013 09:48:53 +0100
|
-- Colin Watson <cjwatson@debian.org> Mon, 07 Oct 2013 09:48:53 +0100
|
||||||
|
|
||||||
|
191
debian/patches/quick_boot.patch
vendored
Normal file
191
debian/patches/quick_boot.patch
vendored
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
Description: Add configure option to bypass boot menu if possible
|
||||||
|
If other operating systems are installed, then automatically unhide the
|
||||||
|
menu. Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus if
|
||||||
|
available to check whether Shift is pressed. If it is, show the menu,
|
||||||
|
otherwise boot immediately. If keystatus is not available, then fall back
|
||||||
|
to a short delay interruptible with Escape.
|
||||||
|
.
|
||||||
|
This may or may not remain Ubuntu-specific, although it's not obviously
|
||||||
|
wanted upstream. It implements a requirement of
|
||||||
|
https://wiki.ubuntu.com/DesktopExperienceTeam/KarmicBootExperienceDesignSpec#Bootloader.
|
||||||
|
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
Forwarded: no
|
||||||
|
Last-Update: 2013-11-12
|
||||||
|
|
||||||
|
Index: b/configure.ac
|
||||||
|
===================================================================
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -1087,6 +1087,17 @@
|
||||||
|
fi
|
||||||
|
AC_SUBST([QUIET_BOOT])
|
||||||
|
|
||||||
|
+AC_ARG_ENABLE([quick-boot],
|
||||||
|
+ [AS_HELP_STRING([--enable-quick-boot],
|
||||||
|
+ [bypass boot menu if possible (default=no)])],
|
||||||
|
+ [], [enable_quick_boot=no])
|
||||||
|
+if test x"$enable_quick_boot" = xyes ; then
|
||||||
|
+ QUICK_BOOT=1
|
||||||
|
+else
|
||||||
|
+ QUICK_BOOT=0
|
||||||
|
+fi
|
||||||
|
+AC_SUBST([QUICK_BOOT])
|
||||||
|
+
|
||||||
|
LIBS=""
|
||||||
|
|
||||||
|
AC_SUBST([FONT_SOURCE])
|
||||||
|
Index: b/util/grub.d/00_header.in
|
||||||
|
===================================================================
|
||||||
|
--- a/util/grub.d/00_header.in
|
||||||
|
+++ b/util/grub.d/00_header.in
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
exec_prefix="@exec_prefix@"
|
||||||
|
datarootdir="@datarootdir@"
|
||||||
|
grub_lang=`echo $LANG | cut -d . -f 1`
|
||||||
|
+quick_boot="@QUICK_BOOT@"
|
||||||
|
|
||||||
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
|
@@ -272,7 +273,7 @@
|
||||||
|
|
||||||
|
make_timeout ()
|
||||||
|
{
|
||||||
|
- if [ "x${1}" != "x" ] ; then
|
||||||
|
+ if [ "$quick_boot" = 0 ] && [ "x${1}" != "x" ] ; then
|
||||||
|
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
||||||
|
verbose=
|
||||||
|
else
|
||||||
|
Index: b/util/grub.d/30_os-prober.in
|
||||||
|
===================================================================
|
||||||
|
--- a/util/grub.d/30_os-prober.in
|
||||||
|
+++ b/util/grub.d/30_os-prober.in
|
||||||
|
@@ -20,18 +20,78 @@
|
||||||
|
prefix="@prefix@"
|
||||||
|
exec_prefix="@exec_prefix@"
|
||||||
|
datarootdir="@datarootdir@"
|
||||||
|
+quick_boot="@QUICK_BOOT@"
|
||||||
|
|
||||||
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
|
|
||||||
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
|
+found_other_os=
|
||||||
|
+
|
||||||
|
+make_timeout () {
|
||||||
|
+ if [ "x${found_other_os}" = "x" ] ; then
|
||||||
|
+ if [ "x${1}" != "x" ] ; then
|
||||||
|
+ if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
||||||
|
+ verbose=
|
||||||
|
+ else
|
||||||
|
+ verbose=" --verbose"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ "x${1}" = "x0" ] ; then
|
||||||
|
+ cat <<EOF
|
||||||
|
+if [ "x\${timeout}" != "x-1" ]; then
|
||||||
|
+ if keystatus; then
|
||||||
|
+ if keystatus --shift; then
|
||||||
|
+ set timeout=-1
|
||||||
|
+ else
|
||||||
|
+ set timeout=0
|
||||||
|
+ fi
|
||||||
|
+ else
|
||||||
|
+ if sleep$verbose --interruptible 3 ; then
|
||||||
|
+ set timeout=0
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+fi
|
||||||
|
+EOF
|
||||||
|
+ else
|
||||||
|
+ cat << EOF
|
||||||
|
+if [ "x\${timeout}" != "x-1" ]; then
|
||||||
|
+ if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
|
||||||
|
+ set timeout=0
|
||||||
|
+ fi
|
||||||
|
+fi
|
||||||
|
+EOF
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+adjust_timeout () {
|
||||||
|
+ if [ "$quick_boot" = 0 ]; then
|
||||||
|
+ return
|
||||||
|
+ fi
|
||||||
|
+ if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
|
||||||
|
+ cat <<EOF
|
||||||
|
+if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
|
||||||
|
+EOF
|
||||||
|
+ make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
|
||||||
|
+ echo else
|
||||||
|
+ make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
|
||||||
|
+ echo fi
|
||||||
|
+ else
|
||||||
|
+ make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
||||||
|
+ adjust_timeout
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
|
||||||
|
# missing os-prober and/or linux-boot-prober
|
||||||
|
+ adjust_timeout
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
@@ -43,10 +103,12 @@
|
||||||
|
OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
|
||||||
|
if [ -z "${OSPROBED}" ] ; then
|
||||||
|
# empty os-prober output, nothing doing
|
||||||
|
+ adjust_timeout
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
osx_entry() {
|
||||||
|
+ found_other_os=1
|
||||||
|
if [ x$2 = x32 ]; then
|
||||||
|
# TRANSLATORS: it refers to kernel architecture (32-bit)
|
||||||
|
bitstr="$(gettext "(32-bit)")"
|
||||||
|
@@ -146,6 +208,7 @@
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
+ found_other_os=1
|
||||||
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
|
cat << EOF
|
||||||
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
||||||
|
@@ -169,6 +232,7 @@
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
efi)
|
||||||
|
+ found_other_os=1
|
||||||
|
EFIPATH=${DEVICE#*@}
|
||||||
|
DEVICE=${DEVICE%@*}
|
||||||
|
cat << EOF
|
||||||
|
@@ -211,6 +275,7 @@
|
||||||
|
[ "${prepare_boot_cache}" ] || continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ found_other_os=1
|
||||||
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
|
recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
|
||||||
|
counter=1
|
||||||
|
@@ -277,6 +342,7 @@
|
||||||
|
osx_entry xnu_kernel64 64
|
||||||
|
;;
|
||||||
|
hurd)
|
||||||
|
+ found_other_os=1
|
||||||
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
|
cat << EOF
|
||||||
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
||||||
|
@@ -309,3 +375,5 @@
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
+
|
||||||
|
+adjust_timeout
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -57,3 +57,4 @@ efidisk_non_512_sectors.patch
|
|||||||
mkconfig_hurd_sort.patch
|
mkconfig_hurd_sort.patch
|
||||||
probe_dmraid.patch
|
probe_dmraid.patch
|
||||||
install_efi_ubuntu_flavours.patch
|
install_efi_ubuntu_flavours.patch
|
||||||
|
quick_boot.patch
|
||||||
|
2
debian/rules
vendored
2
debian/rules
vendored
@ -54,7 +54,7 @@ endif
|
|||||||
|
|
||||||
ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
|
ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
|
||||||
DEFAULT_CMDLINE := quiet splash
|
DEFAULT_CMDLINE := quiet splash
|
||||||
confflags += --enable-quiet-boot
|
confflags += --enable-quiet-boot --enable-quick-boot
|
||||||
else
|
else
|
||||||
DEFAULT_CMDLINE := quiet
|
DEFAULT_CMDLINE := quiet
|
||||||
endif
|
endif
|
||||||
|
@ -23,6 +23,7 @@ prefix="@prefix@"
|
|||||||
exec_prefix="@exec_prefix@"
|
exec_prefix="@exec_prefix@"
|
||||||
datarootdir="@datarootdir@"
|
datarootdir="@datarootdir@"
|
||||||
grub_lang=`echo $LANG | cut -d . -f 1`
|
grub_lang=`echo $LANG | cut -d . -f 1`
|
||||||
|
quick_boot="@QUICK_BOOT@"
|
||||||
|
|
||||||
export TEXTDOMAIN=@PACKAGE@
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
export TEXTDOMAINDIR="@localedir@"
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
@ -272,7 +273,7 @@ fi
|
|||||||
|
|
||||||
make_timeout ()
|
make_timeout ()
|
||||||
{
|
{
|
||||||
if [ "x${1}" != "x" ] ; then
|
if [ "$quick_boot" = 0 ] && [ "x${1}" != "x" ] ; then
|
||||||
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
||||||
verbose=
|
verbose=
|
||||||
else
|
else
|
||||||
|
@ -20,18 +20,78 @@ set -e
|
|||||||
prefix="@prefix@"
|
prefix="@prefix@"
|
||||||
exec_prefix="@exec_prefix@"
|
exec_prefix="@exec_prefix@"
|
||||||
datarootdir="@datarootdir@"
|
datarootdir="@datarootdir@"
|
||||||
|
quick_boot="@QUICK_BOOT@"
|
||||||
|
|
||||||
export TEXTDOMAIN=@PACKAGE@
|
export TEXTDOMAIN=@PACKAGE@
|
||||||
export TEXTDOMAINDIR="@localedir@"
|
export TEXTDOMAINDIR="@localedir@"
|
||||||
|
|
||||||
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
||||||
|
|
||||||
|
found_other_os=
|
||||||
|
|
||||||
|
make_timeout () {
|
||||||
|
if [ "x${found_other_os}" = "x" ] ; then
|
||||||
|
if [ "x${1}" != "x" ] ; then
|
||||||
|
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
|
||||||
|
verbose=
|
||||||
|
else
|
||||||
|
verbose=" --verbose"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x${1}" = "x0" ] ; then
|
||||||
|
cat <<EOF
|
||||||
|
if [ "x\${timeout}" != "x-1" ]; then
|
||||||
|
if keystatus; then
|
||||||
|
if keystatus --shift; then
|
||||||
|
set timeout=-1
|
||||||
|
else
|
||||||
|
set timeout=0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if sleep$verbose --interruptible 3 ; then
|
||||||
|
set timeout=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat << EOF
|
||||||
|
if [ "x\${timeout}" != "x-1" ]; then
|
||||||
|
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
|
||||||
|
set timeout=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
adjust_timeout () {
|
||||||
|
if [ "$quick_boot" = 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
|
||||||
|
cat <<EOF
|
||||||
|
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
|
||||||
|
EOF
|
||||||
|
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
|
||||||
|
echo else
|
||||||
|
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
|
||||||
|
echo fi
|
||||||
|
else
|
||||||
|
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
||||||
|
adjust_timeout
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
|
if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
|
||||||
# missing os-prober and/or linux-boot-prober
|
# missing os-prober and/or linux-boot-prober
|
||||||
|
adjust_timeout
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -43,10 +103,12 @@ modprobe efivars >/dev/null 2>&1 || true
|
|||||||
OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
|
OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
|
||||||
if [ -z "${OSPROBED}" ] ; then
|
if [ -z "${OSPROBED}" ] ; then
|
||||||
# empty os-prober output, nothing doing
|
# empty os-prober output, nothing doing
|
||||||
|
adjust_timeout
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
osx_entry() {
|
osx_entry() {
|
||||||
|
found_other_os=1
|
||||||
if [ x$2 = x32 ]; then
|
if [ x$2 = x32 ]; then
|
||||||
# TRANSLATORS: it refers to kernel architecture (32-bit)
|
# TRANSLATORS: it refers to kernel architecture (32-bit)
|
||||||
bitstr="$(gettext "(32-bit)")"
|
bitstr="$(gettext "(32-bit)")"
|
||||||
@ -146,6 +208,7 @@ for OS in ${OSPROBED} ; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
found_other_os=1
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
|
||||||
@ -169,6 +232,7 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
efi)
|
efi)
|
||||||
|
found_other_os=1
|
||||||
EFIPATH=${DEVICE#*@}
|
EFIPATH=${DEVICE#*@}
|
||||||
DEVICE=${DEVICE%@*}
|
DEVICE=${DEVICE%@*}
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ -211,6 +275,7 @@ EOF
|
|||||||
[ "${prepare_boot_cache}" ] || continue
|
[ "${prepare_boot_cache}" ] || continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
found_other_os=1
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
|
recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
|
||||||
counter=1
|
counter=1
|
||||||
@ -277,6 +342,7 @@ EOF
|
|||||||
osx_entry xnu_kernel64 64
|
osx_entry xnu_kernel64 64
|
||||||
;;
|
;;
|
||||||
hurd)
|
hurd)
|
||||||
|
found_other_os=1
|
||||||
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
|
||||||
@ -309,3 +375,5 @@ EOF
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
adjust_timeout
|
||||||
|
Loading…
Reference in New Issue
Block a user