diff --git a/debian/changelog b/debian/changelog index 6610853ad..5e12d5ca1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,7 @@ grub2 (2.00-20) UNRELEASED; urgency=low remove the 'set gfxpayload=keep' command. + Set default timeout to 10 seconds. + Enable hidden timeout support by default. + - Migrate timeout settings from menu.lst. -- Colin Watson Mon, 07 Oct 2013 09:48:53 +0100 diff --git a/debian/config.in b/debian/config.in index ec3806efa..3c09bca61 100644 --- a/debian/config.in +++ b/debian/config.in @@ -31,6 +31,15 @@ case @PACKAGE@ in # if we got something from menu.lst, it must be correct? priority=medium fi + timeout=`sed -ne "s/^timeout[[:space:]][[:space:]]*//p" /boot/grub/menu.lst` || true + if [ "${timeout}" != "" ]; then + db_set grub-pc/timeout "${timeout}" || true + fi + if grep -q '^hiddenmenu\([[:space:]]\|$\)' /boot/grub/menu.lst; then + db_set grub-pc/hidden_timeout true || true + else + db_set grub-pc/hidden_timeout false || true + fi fi fi ;; @@ -49,6 +58,19 @@ if [ "${GRUB_CMDLINE_LINUX_DEFAULT+set}" = set ]; then db_set grub2/linux_cmdline_default "$GRUB_CMDLINE_LINUX_DEFAULT" fi +case @PACKAGE@ in + grub-pc) + if [ "${GRUB_TIMEOUT}" != "" ]; then + db_set grub-pc/timeout "$GRUB_TIMEOUT" + fi + if [ "${GRUB_HIDDEN_TIMEOUT}" != "" ]; then + db_set grub-pc/hidden_timeout true + elif egrep -q '^#?[[:space:]]*GRUB_HIDDEN_TIMEOUT=' /etc/default/grub; then + db_set grub-pc/hidden_timeout false + fi + ;; +esac + db_input ${priority} grub2/linux_cmdline || true db_input medium grub2/linux_cmdline_default || true db_go diff --git a/debian/grub-pc.templates.in b/debian/grub-pc.templates.in index b4a569681..38ec80386 100644 --- a/debian/grub-pc.templates.in +++ b/debian/grub-pc.templates.in @@ -145,3 +145,13 @@ Template: grub-pc/kopt_extracted Type: boolean Default: false Description: for internal use + +Template: grub-pc/timeout +Type: string +Default: @DEFAULT_TIMEOUT@ +Description: GRUB timeout + +Template: grub-pc/hidden_timeout +Type: boolean +Default: @DEFAULT_HIDDEN_TIMEOUT_BOOL@ +Description: Hide the GRUB timeout diff --git a/debian/postinst.in b/debian/postinst.in index 6553aa16c..64be386f8 100644 --- a/debian/postinst.in +++ b/debian/postinst.in @@ -365,6 +365,17 @@ case "$1" in merge_debconf_into_conf "$tmp_default_grub" GRUB_CMDLINE_LINUX grub2/linux_cmdline merge_debconf_into_conf "$tmp_default_grub" GRUB_CMDLINE_LINUX_DEFAULT grub2/linux_cmdline_default + case @PACKAGE@ in + grub-pc) + merge_debconf_into_conf "$tmp_default_grub" GRUB_TIMEOUT grub-pc/timeout + sed -i -e 's/^\(GRUB_TIMEOUT=\)"\([0-9][0-9]*\)"/\1\2/' "$tmp_default_grub" + db_get grub-pc/hidden_timeout + if [ "$RET" = false ]; then + sed -i -e 's/^GRUB_HIDDEN_TIMEOUT=/#&/' "$tmp_default_grub" + fi + ;; + esac + ucf --three-way --debconf-ok --sum-file=/usr/share/grub/default/grub.md5sum ${tmp_default_grub} /etc/default/grub package="$(ucfq --with-colons /etc/default/grub | cut -d : -f 2)" if echo $package | grep -q "^grub-" ; then diff --git a/debian/rules b/debian/rules index 6b9326284..3ac2e507e 100755 --- a/debian/rules +++ b/debian/rules @@ -56,6 +56,7 @@ ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes)) DEFAULT_CMDLINE := quiet splash DEFAULT_TIMEOUT := 10 DEFAULT_HIDDEN_TIMEOUT := 0 +DEFAULT_HIDDEN_TIMEOUT_BOOL := true confflags += \ --enable-ubuntu-recovery \ --enable-quiet-boot \ @@ -69,6 +70,7 @@ else DEFAULT_CMDLINE := quiet DEFAULT_TIMEOUT := 5 DEFAULT_HIDDEN_TIMEOUT := +DEFAULT_HIDDEN_TIMEOUT_BOOL := false substvars := endif @@ -198,6 +200,8 @@ platform_subst = \ -e "s/@PACKAGE@/$(2)/g" \ -e "s/@CPU_PLATFORM@/$$cpu_platform/g" \ -e "s/@DEFAULT_CMDLINE@/$(DEFAULT_CMDLINE)/g" \ + -e "s/@DEFAULT_TIMEOUT@/$(DEFAULT_TIMEOUT)/g" \ + -e "s/@DEFAULT_HIDDEN_TIMEOUT_BOOL@/$(DEFAULT_HIDDEN_TIMEOUT_BOOL)/g" \ >> debian/$(2).$(3); \ fi