From e514bd8dabc35f8bb16856562c71c858f6643a20 Mon Sep 17 00:00:00 2001 From: lub Date: Tue, 28 Jan 2020 19:54:41 +0100 Subject: [PATCH] add grub-pc setup in addition to efi boot --- post-debootstrap-installer.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/post-debootstrap-installer.sh b/post-debootstrap-installer.sh index d00d8da..7f1b2dd 100755 --- a/post-debootstrap-installer.sh +++ b/post-debootstrap-installer.sh @@ -38,9 +38,17 @@ cat /hardware-setup/authorized_keys/* > /etc/dropbear-initramfs/authorized_keys apt-get -y install linux-image-amd64 # install grub -apt-get -y install grub-efi-amd64 -update-grub -grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=GRUB +if [ -d /sys/firmware/efi ]; then + apt-get -y install grub-efi-amd64 + update-grub + grub-install +else + apt-get -y install grub-pc + update-grub + + root_disk="/dev/$(lsblk -no pkname $(cryptsetup status root-unlocked | grep device | perl -pe 's#.*device.* (.*)#$1#') | sort | head -n1)" + grub-install "$root_disk" +fi # edit uuids in fstab root_uuid=$(blkid --output value "/dev/mapper/root-unlocked" | head -n1)