-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathentrypoint
51 lines (42 loc) · 1.62 KB
/
entrypoint
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
46
47
48
49
50
51
#!/bin/sh
if [ -n "$DEBUG" ]; then
set -x
fi
if ! find . -mindepth 1 | read -r; then
>&2 echo "Creating default configs..."
cp -r /opt/cfx-server-data/* /config
RCON_PASS="${RCON_PASSWORD-$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 16)}"
sed -i "s/{RCON_PASS}/${RCON_PASS}/g" /config/server.cfg;
>&2 echo "----------------------------------------------"
>&2 echo "RCON password is set to: ${RCON_PASS}"
>&2 echo "----------------------------------------------"
fi
if [ -z "$NO_ONESYNC" ]; then
ONESYNC_ARGS="+set onesync on +set onesync_population true"
fi
CONFIG_ARGS=
if [ -z "${NO_DEFAULT_CONFIG}" ]; then
CONFIG_ARGS="$CONFIG_ARGS $ONESYNC_ARGS +exec /config/server.cfg"
fi
# English is hard
if [ -z "${NO_LICENSE_KEY}${NO_LICENCE_KEY}" ]; then
if [ -z "${LICENSE_KEY}" ] && [ -n "${LICENCE_KEY}" ]; then
LICENSE_KEY="${LICENCE_KEY}"
fi
if [ -z "${NO_DEFAULT_CONFIG}"] && [ -z "${LICENSE_KEY}" ]; then
>&2 printf "License key not found in environment, please create one at https://keymaster.fivem.net!\n"
exit 1
fi
if [ -z "${CONFIG_ARGS}" ] && [ -n "${LICENSE_KEY}" ] && [ -n "${NO_DEFAULT_CONFIG}" ]; then
>&2 printf "txadmin does not use the \$LICENSE_KEY environment variable.\nPlease remove it and set it through the txadmin web UI\n\n"
exit 1
fi
CONFIG_ARGS="$CONFIG_ARGS +set sv_licenseKey ${LICENSE_KEY}"
fi
exec /opt/cfx-server/ld-musl-x86_64.so.1 \
--library-path "/usr/lib/v8/:/lib/:/usr/lib/" \
-- \
/opt/cfx-server/FXServer \
+set citizen_dir /opt/cfx-server/citizen/ \
$CONFIG_ARGS \
$*