diff --git a/macos/flashusb.sh b/macos/flashusb.sh index 430af9d..93e5d4e 100755 --- a/macos/flashusb.sh +++ b/macos/flashusb.sh @@ -239,34 +239,36 @@ log "Expected config partition after flash: $TARGET_CONFIG_PART" log "Target disk info:" diskutil info "$TARGET_DISK" || die "Unable to inspect target disk" -echo -printf "Type 'YES' to continue: " -read -r CONFIRM -[ "$CONFIRM" = "YES" ] || die "Aborted." +if ! [ "$1" == "config" ]; then + echo + printf "Type 'YES' to continue: " + read -r CONFIRM + [ "$CONFIRM" = "YES" ] || die "Aborted." -log "Unmounting target disk..." -diskutil unmountDisk force "$TARGET_DISK" || die "Failed to unmount $TARGET_DISK" + log "Unmounting target disk..." + diskutil unmountDisk force "$TARGET_DISK" || die "Failed to unmount $TARGET_DISK" -log "Flashing image with progress..." -pv -s "$IMG_SIZE_BYTES" "$IMG" \ - | gunzip \ - | dd of="$TARGET_RAW_DISK" bs=4m + log "Flashing image with progress..." + pv -s "$IMG_SIZE_BYTES" "$IMG" \ + | gunzip \ + | dd of="$TARGET_RAW_DISK" bs=4m -log "Syncing writes..." -sync + log "Syncing writes..." + sync -log "Ejecting and re-reading disk..." -diskutil eject "$TARGET_DISK" >/dev/null 2>&1 || true -sleep 2 + log "Ejecting and re-reading disk..." + diskutil eject "$TARGET_DISK" >/dev/null 2>&1 || true + sleep 2 -log "Waiting for disk to come back..." -if ! wait_for_disk "$TARGET_DISK" 15; then - warn "Disk node did not reappear quickly. You may need to replug the drive." + log "Waiting for disk to come back..." + if ! wait_for_disk "$TARGET_DISK" 15; then + warn "Disk node did not reappear quickly. You may need to replug the drive." + fi + + log "Disk layout after flashing:" + diskutil list "$TARGET_DISK" || warn "Could not list flashed disk yet" fi -log "Disk layout after flashing:" -diskutil list "$TARGET_DISK" || warn "Could not list flashed disk yet" - ENV_FILES="$(find "$SEARCH_DIR" -maxdepth 1 -type f -name '*.env' | sort || true)" if [ -n "$ENV_FILES" ]; then