File size: 1,386 Bytes
30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 534f045 30ee873 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
#!/bin/bash
# exit when any command fails
set -e
# Create a TUN device if it does not exist to ensure compatibility with Podman
if [ ! -e /dev/net/tun ]; then
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
fi
# Start dbus
mkdir -p /run/dbus
if [ -f /run/dbus/pid ]; then
rm /run/dbus/pid
fi
dbus-daemon --config-file=/usr/share/dbus-1/system.conf &
# Start the daemon
warp-svc --accept-tos &
# Sleep to wait for the daemon to start, default 2 seconds
sleep "$WARP_SLEEP"
# If /var/lib/cloudflare-warp/reg.json does not exist, set up new warp client
if [ ! -f /var/lib/cloudflare-warp/reg.json ]; then
# If /var/lib/cloudflare-warp/mdm.xml does not exist or REGISTER_WHEN_MDM_EXISTS is not empty, register the warp client
if [ ! -f /var/lib/cloudflare-warp/mdm.xml ] || [ -n "$REGISTER_WHEN_MDM_EXISTS" ]; then
warp-cli registration new && echo "Warp client registered!"
# If a license key is provided, register the license
if [ -n "$WARP_LICENSE_KEY" ]; then
echo "License key found, registering license..."
warp-cli registration license "$WARP_LICENSE_KEY" && echo "Warp license registered!"
fi
fi
# Connect to the warp server
warp-cli --accept-tos connect
else
echo "Warp client already registered, skipping registration"
fi
# Start the proxy
gost $GOST_ARGS
|