script to create an EFI partition on a target bootdrive if none exists
After rsyncing your OS to the external drive, run this to create a boot partition. You MUST copy the OS first. #!/bin/bash # Ensure script is run as root if [ "$(id -u)" -ne 0 ]; then echo "Please run this script as root (e.g. via sudo)." exit 1 fi # Load USB device detection source /scripts/find_usb.sh || { echo "Failed to load /scripts/find_usb.sh" exit 1 } mountpoint="/media/$(logname)/$usb_uuid" efi_partition="${usb_disk}2" echo "This will FORMAT and INSTALL EFI SYSTEM PARTITION on $efi_partition" echo df -h | grep "$usb_disk" || echo "Warning: device not mounted yet." echo read -rp "Continue with formatting and EFI install on $efi_partition? (y/n): " confirm if [[ "$confirm" != "y" ]]; then echo "Aborted." exit 1 fi # Create EFI partition if it doesn't exist if ! lsblk "$efi_partition" &>/dev/null; then echo "Creating EFI p...