#!/usr/bin/env sh set -e ../setup.sh rm -f terraform.tfstate* ./tf init ./tf plan ./tf apply -auto-approve set +e # Start tor and let it run for a few seconds echo "Starting Tor to verify family key..." timeout 5 tor -f ./torrc >tor.log 2>&1 TOR_EXIT_CODE=$? set -e # Check if tor exited with an error (not due to timeout) # timeout returns 124 when it kills the process if [ $TOR_EXIT_CODE -ne 0 ] && [ $TOR_EXIT_CODE -ne 124 ]; then echo "ERROR: Tor exited with error code $TOR_EXIT_CODE" cat tor.log exit 1 fi # Check if tor started bootstrapping (indicates successful key loading) if grep -q "Bootstrapped [0-9]" tor.log; then echo "SUCCESS: Tor started bootstrapping with generated family key" exit 0 else echo "ERROR: Tor did not start bootstrapping" cat tor.log exit 1 fi