#!/bin/bash # Render deploy/satelliteindex.mld.json with the real admin token and push it to the mld gateway (M1M32:~/dispatch/apps/). # Usage: deploy/render-manifest.sh [--push] set -euo pipefail cd "$(dirname "$0")/.." TOKEN_FILE=deploy/.admin-token [ -s "$TOKEN_FILE" ] || { openssl rand -hex 24 > "$TOKEN_FILE"; echo "generated $TOKEN_FILE"; } TOKEN=$(tr -d '\n' < "$TOKEN_FILE") mkdir -p deploy/rendered sed "s/{{ADMIN_TOKEN}}/$TOKEN/g" deploy/satelliteindex.mld.json > deploy/rendered/satelliteindex.json python3 -c "import json,sys; json.load(open('deploy/rendered/satelliteindex.json')); print('manifest ok')" if [ "${1:-}" = "--push" ]; then scp -q deploy/rendered/satelliteindex.json M1M32:~/dispatch/apps/satelliteindex.json ssh M1M32 'chmod 600 ~/dispatch/apps/satelliteindex.json && echo "pushed to M1M32:~/dispatch/apps/satelliteindex.json"' fi