Browse Source

mounting efi partion within chroot

toastie89 6 months ago
parent
commit
735b616def
1 changed files with 7 additions and 14 deletions
  1. 7 14
      bootstrap-bookworm.sh

+ 7 - 14
bootstrap-bookworm.sh

@@ -102,10 +102,6 @@ then
   
   # Format EFI disk -- pkg: e2fsprogs dosfstools and to file system check
   mkfs.fat  -v -F 32 -n EFIBOOT $disk0 && fsck $disk0
-
-  # Prepare mount points and mount
-  mkdir -p $mnt"/boot/efi"
-  mount $disk0 $mnt"/boot/efi"
 fi
 
 # Create swapfile
@@ -177,9 +173,7 @@ 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
-                 ;;
+   efi-crypt)    grubPkg="grub-efi"  ;;
 esac
 # Install basic system
 
@@ -293,17 +287,18 @@ exit
 
 
 bootloader(){
-# Install grub in the mbr
-echo "$grubPkg selected as bootloader as partition is $partition"
+# Install grub
+echo "$partition 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"
+     "mkdir -p /boot/efi && mount /boot/efi \
+      && grub-install --target=x86_64-efi --efi-directory=/boot/efi \
+                      --bootloader-id=grub && update-grub \
+      && umount /boot/efi"
      ;;
 esac
 }
@@ -315,11 +310,9 @@ unmount(){
 ! mountpoint -q $mnt/sys      || umount $mnt/sys
 ! mountpoint -q $mnt/dev/pts  || umount $mnt/dev/pts
 ! mountpoint -q $mnt/dev      || umount $mnt/dev
-! mountpoint -q $mnt/boot/efi || umount $mnt/boot/efi
 ! mountpoint -q $mnt          || umount $mnt
 # Delete mount-point if empty and not mounted
 [ -d $mnt ]          && [ -z "$(ls -A $mnt)"          ] &&  ! mountpoint -q $mnt           && rm -R $mnt
-[ -d $mnt/boot/efi ] && [ -z "$(ls -A $mnt/boot/efi)" ] &&  ! mountpoint -q $mnt/boot/efi  && rm -R $mnt/boot/efi
 }