From fec14fd40707e96b552a287425e13bed9476d884 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Wed, 26 Feb 2020 15:51:46 +0100 Subject: [PATCH 1/2] 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 3ca4801..6487f4e 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 { From aaf61a3a4f3e226fbeb633c637eefc57d8b3bd24 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Wed, 26 Feb 2020 17:49:23 +0100 Subject: [PATCH 2/2] Rename `clone_efi_partition` to `sync_efi_partitions` (and related objects) --- install-zfs.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/install-zfs.sh b/install-zfs.sh index 6487f4e..b672d1e 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -1047,22 +1047,22 @@ function install_and_configure_bootloader_Debian { chroot_execute "update-grub" } -function clone_efi_partition { +function sync_efi_partitions { print_step_info_header for ((i = 1; i < ${#v_selected_disks[@]}; i++)); do - local cloned_partition_path="/boot/efi$((i + 1))" + local synced_efi_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 "echo PARTUUID=$(blkid -s PARTUUID -o value "${v_selected_disks[i]}-part1") $synced_efi_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 "mkdir -p $synced_efi_partition_path" + chroot_execute "mount $synced_efi_partition_path" - chroot_execute "rsync --archive --delete --verbose /boot/efi/ $cloned_partition_path" + chroot_execute "rsync --archive --delete --verbose /boot/efi/ $synced_efi_partition_path" efibootmgr --create --disk "${v_selected_disks[i]}" --label "ubuntu-$((i + 1))" --loader '\EFI\ubuntu\grubx64.efi' - chroot_execute "umount $cloned_partition_path" + chroot_execute "umount $synced_efi_partition_path" done chroot_execute "umount /boot/efi" @@ -1229,7 +1229,7 @@ fi distro_dependent_invoke "install_jail_zfs_packages" distro_dependent_invoke "install_and_configure_bootloader" -clone_efi_partition +sync_efi_partitions configure_boot_pool_import distro_dependent_invoke "update_zed_cache" --noforce configure_remaining_settings