# Setup script for Th0rgal/satmux on Windows (PowerShell), from https://gitmanual.com/Th0rgal/satmux # Read it before you run it: the commands come from the repo's own README and files. # Run: powershell -ExecutionPolicy Bypass -File .\setup.ps1 $ErrorActionPreference = "Stop" function Write-Step($t) { Write-Host "`n==> $t" -ForegroundColor Cyan } # Windows ships a python that only opens the Microsoft Store; it doesn't count. function Have($c) { $cmd = Get-Command $c -ErrorAction SilentlyContinue; [bool]$cmd -and $cmd.Source -notlike '*\WindowsApps\*' } # New installs change PATH; pick it up without opening a new window. function Update-Path { $env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User") } # Stop when a program fails, like bash's set -e. Dot-sourced, so cd and venv activation carry on to the next step. function Invoke-Step([scriptblock]$Block) { $global:LASTEXITCODE = 0; . $Block; if ($LASTEXITCODE) { throw "Failed with exit code $LASTEXITCODE" } } Write-Step '1/2 Clone the repository' if (-not (Test-Path 'satmux')) { Invoke-Step { git clone https://github.com/Th0rgal/satmux.git } } Set-Location 'satmux' Write-Step '2/2 Follow the README: Setup' # In the maintainers' order. Do the README instructions above first — they cover steps outside the terminal. # (needs Git Bash or WSL on Windows) 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 Invoke-Step { ./bin/satmux-bench } Invoke-Step { ./bin/satmux-get https://example.com/archive.tar.gz } Invoke-Step { ./bin/satmux-macos off } Write-Host 'Set up Th0rgal/satmux.' Write-Host 'Manual: https://gitmanual.com/Th0rgal/satmux'