#!/bin/sh # a7 Alpine->FreeBSD: write FreeBSD 14.4 VM image to the REAL system disk /dev/vdb. set -e DISK=/dev/vdb if [ ! -b "$DISK" ]; then echo "ABORT: $DISK not found"; lsblk; exit 1; fi echo "=== target disk: $DISK ===" lsblk "$DISK" 2>/dev/null || true if mount | grep -q "$DISK"; then echo "ABORT: $DISK is mounted"; exit 1; fi for t in curl xz dd; do command -v "$t" >/dev/null || { echo "MISSING $t"; exit 1; }; done URL=https://download.freebsd.org/releases/VM-IMAGES/14.4-RELEASE/amd64/Latest/FreeBSD-14.4-RELEASE-amd64.raw.xz echo "=== DESTRUCTIVE: overwriting $DISK (Alpine) with FreeBSD in 5s (Ctrl-C aborts) ===" sleep 5 ( set -o pipefail 2>/dev/null || true curl -fSL "$URL" | xz -dc | dd of="$DISK" bs=1M conv=fsync status=progress ) sync echo "=== dd done. partition table on $DISK: ===" fdisk -l "$DISK" 2>/dev/null | head -25 || true echo "=== NEXT: panel -> unmount rescue ISO -> set boot from disk (vdb) -> reboot ==="