[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#759737: debian-installer: Need preseed entry to select default grub device



Package: grub-installer
Version: 1.95
Severity: whishlist
Tags: jessie, patch

I am trying to create a completely automated preseed.cfg file for
a jessie installation that will work on several systems. In my
case, both QEMU VMs and physical servers. Both of these types of
systems have only one possible boot device but have different
boot device files, e,g, /dev/vda and /dev/sda.  The normal way to
do this would be to use "grub-installer/bootdev string" config option.
This option does not work here because we need to specify the exact
device -- /dev/sda or /dev/vda instead of the "only" device.

If I don't use "grub-installer/bootdev", the installer will ask
me whether I want to install on the device found or "nothing", so
my automation fails.

I developed a patch that lets you use the string "default" for
grub-installer/bootdev. This option always picks the appropriate
device. Example:

    grub-installer/bootdev string default

Here is the patch:

Author: Andrew Patterson <andrew.patterson@hp.com>
Date:   Thu Aug 14 14:00:47 2014 -0600

    Using "default" for bootdev will install grub on default disk.

    The grub-install/bootdev configuration value is used in a
    file to automatically select the grub install device. It works
    fine if the disk is always the same, e.g., /dev/sda, but does
    not work well when using the same preseed file on systems withi
    different types of disks, e.g., /dev/vda and /dev/hda.

    Setting grub-installer/bootdev to "default" will automatically
    select the first disk for grug installation. It works as long
    as there is only one choice of disk to install on and thus
    avoids the "Please select /dev/... or none" question.

diff --git a/grub-installer b/grub-installer
index 50155a9..12f9a31 100755
--- a/grub-installer
+++ b/grub-installer
@@ -678,7 +678,11 @@ while : ; do
            log "q='$q' state='$state' defbd='$default_bootdev' bd='$bootdev'"
        db_fget grub-installer/bootdev seen
        if [ "$RET" = true ] && db_get grub-installer/bootdev && [ "$RET" ] ; then
-               bootdev=$RET
+               if  [ "$RET" = "default" ]; then
+                       bootdev=$default_bootdev
+               else
+                       bootdev=$RET
+               fi
                break
        elif [ "$state" = 1 ]; then
                db_input high $q || true


Reply to: