#!/usr/bin/env bash # Setup script for Th0rgal/satmux on macOS, from https://gitmanual.com/Th0rgal/satmux # Read it before you run it: the commands come from the repo's own README and files. # Run: bash setup.sh set -eo pipefail trap 'echo "Setup stopped at the step above. Steps and fixes: https://gitmanual.com/Th0rgal/satmux" >&2' ERR step() { printf '\n\033[1m==> %s\033[0m\n' "$1"; } have() { command -v "$1" >/dev/null 2>&1; } # Installers put programs here; make them usable right away. export PATH="$HOME/.local/share/mise/shims:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/.deno/bin:$HOME/.bun/bin:$PATH" # nvm is a shell function, so load it into this script when it's installed. export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" load_nvm() { [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" || { have brew && [ -s "$(brew --prefix nvm 2>/dev/null)/nvm.sh" ] && mkdir -p "$NVM_DIR" && . "$(brew --prefix nvm)/nvm.sh"; }; } have_nvm() { load_nvm >/dev/null 2>&1; type nvm >/dev/null 2>&1; } step '1/2 Clone the repository' [ -d 'satmux' ] || git clone https://github.com/Th0rgal/satmux.git cd 'satmux' step '2/2 Follow the README: Setup' # In the maintainers' order. Do the README instructions above first — they cover steps outside the terminal. openssl rand -hex 32 > mux.psk && chmod 600 mux.psk # (fill in your own values, then run it) scp satmux.py mux.psk root@:/root/ # (fill in your own values, then run it) ssh root@ 'nohup env SATMUX_PSK=$(cat /root/mux.psk) python3 /root/satmux.py server --port 8444 >/var/log/satmux.log 2>&1 &' # (fill in your own values, then run it) SATMUX_PSK=$(cat mux.psk) python3 satmux.py client --host --port 8444 --carriers 12 & # (fill in your own values, then run it) ./bin/satmux-macos on ./bin/satmux-bench ./bin/satmux-get https://example.com/archive.tar.gz ./bin/satmux-macos off echo 'Set up Th0rgal/satmux.' echo 'Manual: https://gitmanual.com/Th0rgal/satmux'