Files
gs-warp/client/gs-warp-simple.sh
T
2026-07-26 10:13:48 +03:00

28 lines
698 B
Bash
Executable File

#!/bin/sh
# Client-side GS-Warp launcher
# Created by Luxferre in 2026, released into the public domain
[ -z "$OVPNCFG" ] && OVPNCFG="$1"
[ -z "$OVPNCFG" ] && OVPNCFG="client.ovpn"
printf "Using config from %s...\n" "$OVPNCFG"
GSPIDFILE='/tmp/gswarp-gs.pid'
OVPIDFILE='/tmp/gswarp-ov.pid'
BEFORE_PIDS=$(pgrep -x gs-netcat 2>/dev/null)
gs-netcat -D -p 1194 -s $(md5sum "$OVPNCFG" | cut -d ' ' -f 1)
sleep 2
AFTER_PIDS=$(pgrep -x gs-netcat 2>/dev/null)
if [ -n "$BEFORE_PIDS" ]; then
echo "$AFTER_PIDS" | grep -v -F -x "$BEFORE_PIDS" > "$GSPIDFILE"
else
echo "$AFTER_PIDS" > "$GSPIDFILE"
fi
sudo openvpn --daemon gs-warp --config "$OVPNCFG" --writepid "$OVPIDFILE"
echo 'GS-Warp started'