#!/bin/bash # Installs the runner, run.sh, port.json and the GGUF weights into DEST (this Mac is the device). set -euo pipefail cd "$(dirname "$0")" DEST="${1:?usage: deploy.sh DEST}" [ -x bin/nnopt_runner ] || { echo "run build.sh first" >&2; exit 1; } MODEL_SRC="$(cat bin/model_path.txt)" [ -f "$MODEL_SRC" ] || { echo "weights not found: $MODEL_SRC" >&2; exit 1; } mkdir -p "$DEST" cp bin/nnopt_runner "$DEST/nnopt_runner" cp src/run.sh "$DEST/run.sh" # APFS clone when possible (instant, no extra space); plain copy otherwise. if ! cmp -s "$MODEL_SRC" "$DEST/Bonsai-27B-Q1_0.gguf" 2>/dev/null; then rm -f "$DEST/Bonsai-27B-Q1_0.gguf" cp -c "$MODEL_SRC" "$DEST/Bonsai-27B-Q1_0.gguf" 2>/dev/null || cp "$MODEL_SRC" "$DEST/Bonsai-27B-Q1_0.gguf" fi cat > "$DEST/port.json" <