Browse Source

mounting efi partion within chroot

toastie89 1 year 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
   # Format EFI disk -- pkg: e2fsprogs dosfstools and to file system check
   mkfs.fat  -v -F 32 -n EFIBOOT $disk0 && fsck $disk0
   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
 fi
 
 
 # Create swapfile
 # Create swapfile
@@ -177,9 +173,7 @@ source /installer/config.sh
 # Select grub version based on partition table
 # Select grub version based on partition table
 case "$partition" in
 case "$partition" in
    mbr-single)   grubPkg="grub-pc"   ;;
    mbr-single)   grubPkg="grub-pc"   ;;
-   efi-crypt)    grubPkg="grub-efi" 
-                 #grub-efi-amd64-bin
-                 ;;
+   efi-crypt)    grubPkg="grub-efi"  ;;
 esac
 esac
 # Install basic system
 # Install basic system
 
 
@@ -293,17 +287,18 @@ exit
 
 
 
 
 bootloader(){
 bootloader(){
-# Install grub in the mbr
-echo "$grubPkg selected as bootloader as partition is $partition"
+# Install grub
+echo "$partition partition"
 case "$partition" in
 case "$partition" in
    mbr-single) 
    mbr-single) 
-     echo ----mbr
      chroot $mnt /bin/bash -c "grub-install $disk && update-grub"
      chroot $mnt /bin/bash -c "grub-install $disk && update-grub"
      ;;
      ;;
    efi-crypt)
    efi-crypt)
-     echo ---efi
      chroot $mnt /bin/bash -c \
      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
 esac
 }
 }
@@ -315,11 +310,9 @@ unmount(){
 ! mountpoint -q $mnt/sys      || umount $mnt/sys
 ! mountpoint -q $mnt/sys      || umount $mnt/sys
 ! mountpoint -q $mnt/dev/pts  || umount $mnt/dev/pts
 ! mountpoint -q $mnt/dev/pts  || umount $mnt/dev/pts
 ! mountpoint -q $mnt/dev      || umount $mnt/dev
 ! mountpoint -q $mnt/dev      || umount $mnt/dev
-! mountpoint -q $mnt/boot/efi || umount $mnt/boot/efi
 ! mountpoint -q $mnt          || umount $mnt
 ! mountpoint -q $mnt          || umount $mnt
 # Delete mount-point if empty and not mounted
 # Delete mount-point if empty and not mounted
 [ -d $mnt ]          && [ -z "$(ls -A $mnt)"          ] &&  ! mountpoint -q $mnt           && rm -R $mnt
 [ -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
 }
 }