#!/usr/bin/env bash # Deploy this checkout (including uncommitted changes) to a server over SSH: # HOST=root@ ./deploy.sh # Copies the code to /opt/gsm/src on the server and runs install.sh there. SITE= is passed on if set. set -euo pipefail [ -n "${HOST:-}" ] || { echo "usage: HOST=root@ $0" >&2; exit 1; } cd "$(dirname "$0")" tar -czf - --exclude=__pycache__ app caddy install.sh | ssh "$HOST" 'rm -rf /opt/gsm/src && mkdir -p /opt/gsm/src && tar -xzf - -C /opt/gsm/src' ssh "$HOST" "${SITE:+SITE=$(printf %q "$SITE") }GSM_SRC=/opt/gsm/src bash /opt/gsm/src/install.sh"