Spaces:
Paused
Paused
Update entrypoint.sh
Browse files- entrypoint.sh +8 -17
entrypoint.sh
CHANGED
|
@@ -6,7 +6,7 @@ set -e
|
|
| 6 |
# Set a default value for WARP_SLEEP if not set
|
| 7 |
: "${WARP_SLEEP:=2}"
|
| 8 |
|
| 9 |
-
# Start the WARP
|
| 10 |
echo "Starting WARP service..."
|
| 11 |
warp-svc --accept-tos &
|
| 12 |
|
|
@@ -14,27 +14,18 @@ warp-svc --accept-tos &
|
|
| 14 |
echo "Sleeping for $WARP_SLEEP seconds to allow WARP service to start..."
|
| 15 |
sleep "$WARP_SLEEP"
|
| 16 |
|
| 17 |
-
# Check if WARP is registered; if not, perform registration and connection
|
| 18 |
-
if [ ! -f /var/lib/cloudflare-warp/reg.json ]; then
|
| 19 |
-
echo "Registering WARP client..."
|
| 20 |
-
warp-cli register && echo "Warp client registered!"
|
| 21 |
-
|
| 22 |
-
# If a license key is provided, register the license
|
| 23 |
-
if [ -n "$WARP_LICENSE_KEY" ]; then
|
| 24 |
-
echo "License key found, registering license..."
|
| 25 |
-
warp-cli register --license "$WARP_LICENSE_KEY" && echo "Warp license registered!"
|
| 26 |
-
fi
|
| 27 |
-
else
|
| 28 |
-
echo "WARP client is already registered."
|
| 29 |
-
fi
|
| 30 |
-
|
| 31 |
# Set WARP to proxy mode and connect
|
| 32 |
echo "Setting WARP to proxy mode..."
|
| 33 |
warp-cli --accept-tos set-mode proxy
|
| 34 |
warp-cli --accept-tos connect
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# Placeholder for executing a Python script (uncomment to use)
|
| 40 |
# echo "Executing Python script..."
|
|
|
|
| 6 |
# Set a default value for WARP_SLEEP if not set
|
| 7 |
: "${WARP_SLEEP:=2}"
|
| 8 |
|
| 9 |
+
# Start the WARP service in the background
|
| 10 |
echo "Starting WARP service..."
|
| 11 |
warp-svc --accept-tos &
|
| 12 |
|
|
|
|
| 14 |
echo "Sleeping for $WARP_SLEEP seconds to allow WARP service to start..."
|
| 15 |
sleep "$WARP_SLEEP"
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Set WARP to proxy mode and connect
|
| 18 |
echo "Setting WARP to proxy mode..."
|
| 19 |
warp-cli --accept-tos set-mode proxy
|
| 20 |
warp-cli --accept-tos connect
|
| 21 |
|
| 22 |
+
# Check if WARP is connected
|
| 23 |
+
if warp-cli --accept-tos status | grep -q "Connected"; then
|
| 24 |
+
echo "WARP is running in proxy mode."
|
| 25 |
+
else
|
| 26 |
+
echo "Failed to connect WARP in proxy mode."
|
| 27 |
+
exit 1
|
| 28 |
+
fi
|
| 29 |
|
| 30 |
# Placeholder for executing a Python script (uncomment to use)
|
| 31 |
# echo "Executing Python script..."
|