From fec14fd40707e96b552a287425e13bed9476d884 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Wed, 26 Feb 2020 15:51:46 +0100 Subject: [PATCH] Prepare EFI partitions via rsync This is much better practice, primarily because sharing the same UUID across different partitions is dangerous (see #7). Closes #7. --- install-zfs.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/install-zfs.sh b/install-zfs.sh index 3ca48017..6487f4e1 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -1028,8 +1028,6 @@ function install_and_configure_bootloader { # performed on 18.04, but it's better to keep this reference just in case. chroot_execute "update-grub" - - chroot_execute "umount /boot/efi" } function install_and_configure_bootloader_Debian { @@ -1047,17 +1045,27 @@ function install_and_configure_bootloader_Debian { chroot_execute "perl -i -pe 's/#(GRUB_TERMINAL=console)/\$1/' /etc/default/grub" chroot_execute "update-grub" - - chroot_execute "umount /boot/efi" } function clone_efi_partition { print_step_info_header for ((i = 1; i < ${#v_selected_disks[@]}; i++)); do - dd if="${v_selected_disks[0]}-part1" of="${v_selected_disks[i]}-part1" + local cloned_partition_path="/boot/efi$((i + 1))" + + chroot_execute "echo PARTUUID=$(blkid -s PARTUUID -o value "${v_selected_disks[i]}-part1") $cloned_partition_path vfat nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab" + + chroot_execute "mkdir -p $cloned_partition_path" + chroot_execute "mount $cloned_partition_path" + + chroot_execute "rsync --archive --delete --verbose /boot/efi/ $cloned_partition_path" + efibootmgr --create --disk "${v_selected_disks[i]}" --label "ubuntu-$((i + 1))" --loader '\EFI\ubuntu\grubx64.efi' + + chroot_execute "umount $cloned_partition_path" done + + chroot_execute "umount /boot/efi" } function configure_boot_pool_import {