SPB Git
863 B · 16 lines shellscript
1#!/bin/bash2# Render deploy/satelliteindex.mld.json with the real admin token and push it to the mld gateway (M1M32:~/dispatch/apps/).3# Usage: deploy/render-manifest.sh [--push]4set -euo pipefail5cd "$(dirname "$0")/.."6TOKEN_FILE=deploy/.admin-token7[ -s "$TOKEN_FILE" ] || { openssl rand -hex 24 > "$TOKEN_FILE"; echo "generated $TOKEN_FILE"; }8TOKEN=$(tr -d '\n' < "$TOKEN_FILE")9mkdir -p deploy/rendered10sed "s/{{ADMIN_TOKEN}}/$TOKEN/g" deploy/satelliteindex.mld.json > deploy/rendered/satelliteindex.json11python3 -c "import json,sys; json.load(open('deploy/rendered/satelliteindex.json')); print('manifest ok')"12if [ "${1:-}" = "--push" ]; then13  scp -q deploy/rendered/satelliteindex.json M1M32:~/dispatch/apps/satelliteindex.json14  ssh M1M32 'chmod 600 ~/dispatch/apps/satelliteindex.json && echo "pushed to M1M32:~/dispatch/apps/satelliteindex.json"'15fi16
Files · 0a59d343d7589b9f78aea1f4c0e42181efb3402f
Menu

Theme