Interactive drive picker if a drive is not selected

Co-authored-by: @Mrid22
Closes #4596
This commit is contained in:
David Heinemeier Hansson
2026-02-17 11:25:09 +01:00
parent 40bff09c84
commit 02fd1961b9

View File

@@ -4,15 +4,33 @@ alias decompress="tar -xzf"
# Write iso file to sd card # Write iso file to sd card
iso2sd() { iso2sd() {
if [ $# -ne 2 ]; then if [[ $# -lt 1 ]]; then
echo "Usage: iso2sd <input_file> <output_device>" echo "Usage: iso2sd <input_file> [output_device]"
echo "Example: iso2sd ~/Downloads/ubuntu-25.04-desktop-amd64.iso /dev/sda" echo "Example: iso2sd ~/Downloads/ubuntu-25.04-desktop-amd64.iso /dev/sda"
echo -e "\nAvailable SD cards:" return 1
lsblk -d -o NAME | grep -E '^sd[a-z]' | awk '{print "/dev/"$1}'
else
sudo dd bs=4M status=progress oflag=sync if="$1" of="$2"
sudo eject $2
fi fi
local iso="$1"
local drive="$2"
if [[ -z $drive ]]; then
local available_sds=$(lsblk -dpno NAME | grep -E '/dev/sd')
if [[ -z $available_sds ]]; then
echo "No SD drives found and no drive specified"
return 1
fi
drive=$(omarchy-drive-select "$available_sds")
if [[ -z $drive ]]; then
echo "No drive selected"
return 1
fi
fi
sudo dd bs=4M status=progress oflag=sync if="$iso" of="$drive"
sudo eject "$drive"
} }
# Format an entire drive for a single partition using exFAT # Format an entire drive for a single partition using exFAT