Browse Source

moved grub selection in install2; changed grub selection to case

toastie89 6 months ago
parent
commit
c5317439ee
1 changed files with 23 additions and 20 deletions
  1. 23 20
      bootstrap-bookworm.sh

+ 23 - 20
bootstrap-bookworm.sh

@@ -46,11 +46,6 @@ extraPackages="qemu-guest-agent"    # additional packages to install, e.g. crypt
 # Overwrite default variables from config file
 [ -f ./config.sh ] && source config.sh
 
-# Select grub version based on partition table
-case "$partition" in
-   mbr-single)   grubPkg="grub-pc"   ;;
-   efi-crypt)    grubPkg="grub-efi"  ;;
-esac
 
 
 # Setup network in grml
@@ -179,8 +174,18 @@ $0 bootloader
 # Function executed within chroot
 install2(){
 source /installer/config.sh 
+# Select grub version based on partition table
+case "$partition" in
+   mbr-single)   grubPkg="grub-pc"   ;;
+   efi-crypt)    grubPkg="grub-efi" 
+                 #grub-efi-amd64-bin
+                 ;;
+esac
 # Install basic system
+
 apt-get update
+export DEBIAN_FRONTEND=noninteractive
+echo ------installing $grubPkg
 apt-get install --yes \
   apt-utils dialog msmtp-mta \
   systemd-sysv locales tzdata haveged \
@@ -288,24 +293,22 @@ exit
 
 
 bootloader(){
-
 # Install grub in the mbr
-echo "$grubPkg selected as bootloader"
-if [ $partition="mbr-single" ]
-then
-  echo ---mbr
-  chroot $mnt /bin/bash -c "grub-install $disk && update-grub"
-fi
-
-# Install grub in the efi partition
-if [ $partition="efi-crypt" ]
-then
-  echo ---efi
-  chroot $mnt /bin/bash -c \
-  "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub && update-grub" 
-fi
+echo "$grubPkg selected as bootloader as partition is $partition"
+case "$partition" in
+   mbr-single) 
+     echo ----mbr
+     chroot $mnt /bin/bash -c "grub-install $disk && update-grub"
+     ;;
+   efi-crypt)
+     echo ---efi
+     chroot $mnt /bin/bash -c \
+     "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub && update-grub"
+     ;;
+esac
 }
 
+
 unmount(){
 # Unmount if mounted
 ! mountpoint -q $mnt/proc     || umount $mnt/proc