Files
VoxVera/voxvera-run.sh
thePR0M3TH3AN 0b03a4945d update
2025-06-21 20:02:29 -04:00

43 lines
1.4 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# --------------------------------------------------------------------
# VoxVera runtime launcher check Tor, fire up OnionShare + VoxVera
# --------------------------------------------------------------------
set -euo pipefail
TOR_SOCKS_PORT=${TOR_SOCKS_PORT:-9050}
TOR_CONTROL_PORT=${TOR_CONTROL_PORT:-9051}
TORRC="$HOME/.voxvera/torrc"
command_exists() { command -v "$1" &>/dev/null; }
die() { printf "\e[31m%s\e[0m\n" "$*" >&2; exit 1; }
## -------- ensure tor is running ------------------------------------
tor_ok() {
# quick check: can we connect to socks port?
(exec 3<>/dev/tcp/127.0.0.1/$TOR_SOCKS_PORT) 2>/dev/null
}
if ! tor_ok; then
echo ">> Tor isnt running attempting to start it..."
if command_exists systemctl; then
sudo systemctl start tor.service || true
sleep 3
fi
if ! tor_ok; then
# fallback: foreground tor (detached)
tor -f "$TORRC" --hush &>/dev/null &
sleep 5
tor_ok || die "Tor failed to start check $TORRC"
fi
fi
echo ">> Tor OK on ports $TOR_SOCKS_PORT / $TOR_CONTROL_PORT"
export TOR_SOCKS_PORT TOR_CONTROL_PORT
## -------- launch VoxVera -------------------------------------------
if ! command_exists voxvera; then
die "voxvera not in PATH did you complete the install?"
fi
echo ">> Running VoxVera quickstart (non-interactive)"
voxvera quickstart --non-interactive