#!/usr/bin/env bash # flash.sh — flash stock OpenBSD install ISO to USB # Usage: ./flash.sh /dev/sdX set -euo pipefail DEV="${1:-}" [[ -n "$DEV" && -b "$DEV" ]] || { echo "Usage: $0 /dev/sdX"; exit 1; } case "$DEV" in /dev/nvme*|/dev/sda|/dev/mmcblk*|/dev/vd*) echo "ERR: refusing internal $DEV" >&2; exit 2;; esac URL="https://cdn.openbsd.org/pub/OpenBSD/7.6/amd64/install76.iso" ISO=/tmp/install76.iso [[ -f "$ISO" ]] || { echo "[*] downloading $URL"; curl -fL -o "$ISO" "$URL"; } echo "About to flash $ISO -> $DEV. Type yes:" read -r ANS; [[ "$ANS" == "yes" ]] || exit 1 sudo dd if="$ISO" of="$DEV" bs=4M status=progress conv=fsync oflag=direct sudo sync sudo eject "$DEV" echo "EJECTED — pull, plug into edge box, install"