Optionally re-enable os-prober

Add debconf logic for GRUB_DISABLE_OS_PROBER to make it easier to
control things here. Particularly useful for the installer.
Closes: #1031594, #1012865.
This commit is contained in:
Steve McIntyre 2023-04-17 21:59:41 +01:00
parent 53aecee25b
commit d73cec07b9
5 changed files with 41 additions and 3 deletions

3
debian/changelog vendored
View File

@ -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):

5
debian/config.in vendored
View File

@ -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

9
debian/default/grub vendored
View File

@ -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

13
debian/postinst.in vendored
View File

@ -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

14
debian/templates.in vendored
View File

@ -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