From 02fd1961b9eaedb51b15e5c0ea91373ff5a7c47a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 17 Feb 2026 11:25:09 +0100 Subject: [PATCH] Interactive drive picker if a drive is not selected Co-authored-by: @Mrid22 Closes #4596 --- default/bash/functions | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/default/bash/functions b/default/bash/functions index d7f6f2d4..b7a91d79 100644 --- a/default/bash/functions +++ b/default/bash/functions @@ -4,15 +4,33 @@ alias decompress="tar -xzf" # Write iso file to sd card iso2sd() { - if [ $# -ne 2 ]; then - echo "Usage: iso2sd " + if [[ $# -lt 1 ]]; then + echo "Usage: iso2sd [output_device]" echo "Example: iso2sd ~/Downloads/ubuntu-25.04-desktop-amd64.iso /dev/sda" - echo -e "\nAvailable SD cards:" - 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 + return 1 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