Port443 commited on
Commit
534f045
·
verified ·
1 Parent(s): 8970d9e

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +17 -17
entrypoint.sh CHANGED
@@ -3,42 +3,42 @@
3
  # exit when any command fails
4
  set -e
5
 
6
- # create a tun device if not exist to ensure compatibility with Podman
7
  if [ ! -e /dev/net/tun ]; then
8
- sudo mkdir -p /dev/net
9
- sudo mknod /dev/net/tun c 10 200
10
- sudo chmod 600 /dev/net/tun
11
  fi
12
 
13
- # start dbus
14
- sudo mkdir -p /run/dbus
15
  if [ -f /run/dbus/pid ]; then
16
- sudo rm /run/dbus/pid
17
  fi
18
- sudo dbus-daemon --config-file=/usr/share/dbus-1/system.conf
19
 
20
- # start the daemon
21
- sudo 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 not exists, setup new warp client
27
  if [ ! -f /var/lib/cloudflare-warp/reg.json ]; then
28
- # if /var/lib/cloudflare-warp/mdm.xml not exists or REGISTER_WHEN_MDM_EXISTS 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, skip registration"
41
  fi
42
 
43
- # start the proxy
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