From dabbd8feacb41ec5f8fc587c4c10ae3a62266fdc Mon Sep 17 00:00:00 2001 From: dann frazier Date: Thu, 19 Jan 2017 14:43:04 -0700 Subject: [PATCH] Add grub2/update_nvram template to allow users to disable NVRAM updates during package upgrades (LP: #1642298). --- debian/changelog | 5 +++++ debian/config.in | 5 +++++ debian/postinst.in | 13 +++++++++++-- debian/templates.in | 10 ++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 361d310e3..2c5651464 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,13 @@ grub2 (2.02~beta3-4) UNRELEASED; urgency=medium + [ Colin Watson ] * Drop build-dependency on libxen-dev, unnecessary now that upstream has taken a copy of the necessary public headers. + [ dann frazier ] + * Add grub2/update_nvram template to allow users to disable NVRAM + updates during package upgrades (LP: #1642298). + -- Colin Watson Sat, 05 Nov 2016 14:37:18 +0000 grub2 (2.02~beta3-3) unstable; urgency=medium diff --git a/debian/config.in b/debian/config.in index 27775c324..aa774ba88 100644 --- a/debian/config.in +++ b/debian/config.in @@ -78,4 +78,9 @@ case @PACKAGE@ in db_input low grub2/force_efi_extra_removable || true ;; esac +case @PACKAGE@ in + grub-*efi*|grub-ieee1275) + db_input low grub2/update_nvram || true + ;; +esac db_go diff --git a/debian/postinst.in b/debian/postinst.in index fa6d736bf..1fe45ba0d 100644 --- a/debian/postinst.in +++ b/debian/postinst.in @@ -299,6 +299,13 @@ running_in_container() type systemd-detect-virt >/dev/null 2>&1 && systemd-detect-virt --quiet --container } +no_nvram_arg() { + db_get grub2/update_nvram + if [ "$RET" = false ]; then + echo "--no-nvram" + fi +} + run_grub_install() { if ! grub-install $@ ; then @@ -698,7 +705,8 @@ case "$1" in if [ "$RET" = true ]; then FORCE_EXTRA_REMOVABLE="--force-extra-removable" fi - run_grub_install --target="$target" "$FORCE_EXTRA_REMOVABLE" + NO_NVRAM="$(no_nvram_arg)" + run_grub_install --target="$target" "$FORCE_EXTRA_REMOVABLE" "$NO_NVRAM" fi # /boot/grub/ has more chances of being accessible by GRUB @@ -720,7 +728,8 @@ case "$1" in # Output may be empty; if so, just update the core image but # don't install it to any PReP partition. prep_bootdev="$(/usr/lib/grub/powerpc-ieee1275/prep-bootdev)" - run_grub_install --target=powerpc-ieee1275 $prep_bootdev + NO_NVRAM="$(no_nvram_arg)" + run_grub_install --target=powerpc-ieee1275 $prep_bootdev "$NO_NVRAM" ;; esac ;; diff --git a/debian/templates.in b/debian/templates.in index c71ae97b7..2a8a2dd24 100644 --- a/debian/templates.in +++ b/debian/templates.in @@ -24,6 +24,16 @@ _Description: Force extra installation to the EFI removable media path? GRUB is configured successfully to be able to boot any other OS installations correctly. +Template: grub2/update_nvram +Type: boolean +Default: true +_Description: Update NVRAM variables to automatically boot into Debian? + GRUB can configure your platform's NVRAM variables so that it boots into + Debian automatically when powered on. However, you may prefer to disable + this behavior and avoid changes to your boot configuration. For example, + if your NVRAM variables have been setup such that your system contacts a + PXE server on every boot, this would preserve that behavior. + # still unused Template: grub2/kfreebsd_cmdline Type: string -- 2.39.2