Browse Source

moved grub selection in install2; changed grub selection to case

toastie89 1 year 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
 # Overwrite default variables from config file
 [ -f ./config.sh ] && source config.sh
 [ -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
 # Setup network in grml
@@ -179,8 +174,18 @@ $0 bootloader
 # Function executed within chroot
 # Function executed within chroot
 install2(){
 install2(){
 source /installer/config.sh 
 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
 # Install basic system
+
 apt-get update
 apt-get update
+export DEBIAN_FRONTEND=noninteractive
+echo ------installing $grubPkg
 apt-get install --yes \
 apt-get install --yes \
   apt-utils dialog msmtp-mta \
   apt-utils dialog msmtp-mta \
   systemd-sysv locales tzdata haveged \
   systemd-sysv locales tzdata haveged \
@@ -288,24 +293,22 @@ exit
 
 
 
 
 bootloader(){
 bootloader(){
-
 # Install grub in the mbr
 # 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(){
 # Unmount if mounted
 # Unmount if mounted
 ! mountpoint -q $mnt/proc     || umount $mnt/proc
 ! mountpoint -q $mnt/proc     || umount $mnt/proc