85 lines
2.3 KiB
Bash
Executable File
85 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build a portable USB tarball: LAUNCH.sh, data template, README, optional binaries.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
OUT_DIR="${1:-$ROOT/dist}"
|
|
STAMP="$(date -u +%Y%m%d)"
|
|
PKG_NAME="forge-mesh-portable-${STAMP}"
|
|
STAGE="$OUT_DIR/$PKG_NAME"
|
|
ARCHIVE="$OUT_DIR/${PKG_NAME}.tar.gz"
|
|
|
|
echo "==> Staging portable deck at $STAGE"
|
|
rm -rf "$STAGE"
|
|
mkdir -p "$STAGE"/{bin,data,scripts}
|
|
|
|
cp scripts/LAUNCH.sh "$STAGE/scripts/LAUNCH.sh"
|
|
chmod +x "$STAGE/scripts/LAUNCH.sh"
|
|
ln -sf scripts/LAUNCH.sh "$STAGE/LAUNCH.sh"
|
|
|
|
if [[ -f data/config.json ]]; then
|
|
cp data/config.json "$STAGE/data/config.json"
|
|
else
|
|
cat >"$STAGE/data/config.json" <<'EOF'
|
|
{
|
|
"listen_addr": ":8989",
|
|
"data_dir": "./data",
|
|
"database_path": "./data/forge-mesh.db",
|
|
"auth": {
|
|
"basic_username": "admin",
|
|
"basic_password": "changeme",
|
|
"fleet_secret": "change-me-fleet-secret"
|
|
},
|
|
"wallet_policy": {
|
|
"default_wallet": "",
|
|
"currency": "XMR"
|
|
},
|
|
"stratum": {
|
|
"xmr_listen": ":3333",
|
|
"rvn_listen": ":3388",
|
|
"upstream_xmr": "",
|
|
"upstream_rvn": ""
|
|
},
|
|
"forge": {
|
|
"signing_key_path": "./data/signing.key",
|
|
"artifacts_dir": "./data/artifacts"
|
|
},
|
|
"court": {
|
|
"ollama_url": "http://127.0.0.1:11434",
|
|
"enabled": false
|
|
}
|
|
}
|
|
EOF
|
|
fi
|
|
|
|
# Optional: include cloudflared token placeholder (empty = no tunnel until operator fills in).
|
|
touch "$STAGE/data/cloudflared-token.txt.example"
|
|
cat >"$STAGE/data/cloudflared-token.txt.example" <<'EOF'
|
|
# Paste your Cloudflare Tunnel token on a single line, then rename to cloudflared-token.txt
|
|
# Or set AF_TUNNEL_TOKEN in the environment before running LAUNCH.sh
|
|
EOF
|
|
|
|
cp scripts/README-USB.md "$STAGE/README.md"
|
|
|
|
if [[ -x bin/forge-mesh-server ]]; then
|
|
cp bin/forge-mesh-server "$STAGE/bin/forge-mesh-server"
|
|
echo " included bin/forge-mesh-server"
|
|
else
|
|
echo " WARN: bin/forge-mesh-server missing — run 'make server' before packing for a self-contained bundle"
|
|
fi
|
|
|
|
if [[ -x bin/cloudflared ]]; then
|
|
cp bin/cloudflared "$STAGE/bin/cloudflared"
|
|
echo " included bin/cloudflared"
|
|
fi
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
tar -C "$OUT_DIR" -czf "$ARCHIVE" "$PKG_NAME"
|
|
rm -rf "$STAGE"
|
|
|
|
echo "==> Created $ARCHIVE"
|
|
echo " Extract anywhere, edit data/config.json, optionally data/cloudflared-token.txt, then:"
|
|
echo " ./LAUNCH.sh"
|