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