]> git.proxmox.com Git - grub2.git/commitdiff
Optionally re-enable os-prober
authorSteve McIntyre <93sam@debian.org>
Mon, 17 Apr 2023 20:59:41 +0000 (21:59 +0100)
committerSteve McIntyre <93sam@debian.org>
Thu, 20 Apr 2023 20:01:12 +0000 (21:01 +0100)
Add debconf logic for GRUB_DISABLE_OS_PROBER to make it easier to
control things here. Particularly useful for the installer.
Closes: #1031594, #1012865.
debian/changelog
debian/config.in
debian/default/grub
debian/postinst.in
debian/templates.in

index 22e7916eaa016545f79d57b6d74a5c39cc7a22de..ca9fbb00d2eef364900f0cef8cafc9bde067979e 100644 (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):
index c52416dda0fa374f7fc3f1be40f7cb95fe7e246a..2922e4e3a7fdf550e9cfa3cc976407c0d867f5e6 100644 (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
index 9a74fb53e10880b198c4cd4eb7f80226a870571b..03f98ec7fa5522778ad031a90abd0c342bf4253c 100644 (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
index ededae5cbe7d00b3e22a39919fa746a2c75a3311..68f635b5e4f3ef7a8b93992155fe6b32174ba636 100644 (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
index fb0481134bfa85e9956155aa3314230b2dfcd277..ec83fe7a4ae1dd36822a7a16c33772ff9d3fd5e2 100644 (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