diff --git a/debian/changelog b/debian/changelog index 22e7916ea..ca9fbb00d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ grub2 (2.06-9) UNRELEASED; urgency=medium [ Steve McIntyre ] * postinst: make config_item() more robust + * Add debconf logic for GRUB_DISABLE_OS_PROBER to make it easier to + control things here. Particularly useful for the installer. + Closes: #1031594, #1012865. [ Ben Hutchings ] * Fix probing of LUKS2 devices (Closes: #1028301): diff --git a/debian/config.in b/debian/config.in index c52416dda..2922e4e3a 100644 --- a/debian/config.in +++ b/debian/config.in @@ -58,6 +58,10 @@ fi if [ "${GRUB_CMDLINE_LINUX_DEFAULT+set}" = set ]; then db_set grub2/linux_cmdline_default "$GRUB_CMDLINE_LINUX_DEFAULT" fi +# Watch for the inverted logic here... +if [ "${GRUB_DISABLE_OS_PROBER+set}" = set ]; then + db_set grub2/enable_os_prober "false" +fi case @PACKAGE@ in grub-pc) @@ -74,6 +78,7 @@ esac db_input ${priority} grub2/linux_cmdline || true db_input medium grub2/linux_cmdline_default || true +db_input low grub2/enable_os_prober || true case @PACKAGE@ in grub-*efi*) db_input low grub2/force_efi_extra_removable || true diff --git a/debian/default/grub b/debian/default/grub index 9a74fb53e..03f98ec7f 100644 --- a/debian/default/grub +++ b/debian/default/grub @@ -9,9 +9,12 @@ GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="@DEFAULT_CMDLINE@" GRUB_CMDLINE_LINUX="" -# Uncomment this to run os-prober to search for and add other OS -# installations to the grub boot menu -#GRUB_DISABLE_OS_PROBER=false +# If your computer has multiple operating systems installed, then you +# probably want to run os-prober. However, if your computer is a host +# for guest OSes installed via LVM or raw disk devices, running +# os-prober can cause damage to those guest OSes as it mounts +# filesystems to look for things. +GRUB_DISABLE_OS_PROBER=true # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains diff --git a/debian/postinst.in b/debian/postinst.in index ededae5cb..68f635b5e 100644 --- a/debian/postinst.in +++ b/debian/postinst.in @@ -395,6 +395,19 @@ case "$1" in apply_conf_tweaks "$conf_files" merge_debconf_into_conf GRUB_CMDLINE_LINUX grub2/linux_cmdline apply_conf_tweaks "$conf_files" merge_debconf_into_conf GRUB_CMDLINE_LINUX_DEFAULT grub2/linux_cmdline_default + # Horrible stuff here, as the os-prober option is a negative + # setting (GRUB_DISABLE_OS_PROBER). To not confuse people with + # double negative questions in templates, invert it here. + db_get grub2/enable_os_prober + if [ "$RET" = false ]; then + # enable == false -> put in place the commented-out default + # #GRUB_DISABLE_OS_PROBER=false that we ship with + apply_conf_tweaks "$conf_files" sed_conf 's/^.*GRUB_DISABLE_OS_PROBER.*$/#GRUB_DISABLE_OS_PROBER=false/' + else + # enable == true -> put in place a valid GRUB_DISABLE_OS_PROBER=false + apply_conf_tweaks "$conf_files" sed_conf 's/^.*GRUB_DISABLE_OS_PROBER.*$/GRUB_DISABLE_OS_PROBER=false/' + fi + case @PACKAGE@ in grub-pc) apply_conf_tweaks "$conf_files" merge_debconf_into_conf GRUB_TIMEOUT grub-pc/timeout diff --git a/debian/templates.in b/debian/templates.in index fb0481134..ec83fe7a4 100644 --- a/debian/templates.in +++ b/debian/templates.in @@ -34,6 +34,20 @@ _Description: Update NVRAM variables to automatically boot into Debian? if your NVRAM variables have been set up such that your system contacts a PXE server on every boot, this would preserve that behavior. +Template: grub2/enable_os_prober +Type: boolean +Default: false +_Description: Run os-prober automatically to detect and boot other OSes? + GRUB can use the os-prober tool to attempt to detect other + operating systems on your computer and add them to its list of boot + options automatically. + . + If your computer has multiple operating systems installed, then this + is probably what you want. However, if your computer is a host for + guest OSes installed via LVM or raw disk devices, running os-prober + can cause damage to those guest OSes as it mounts filesystems to look + for things. + # still unused Template: grub2/kfreebsd_cmdline Type: string