-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
75 lines (62 loc) · 2.81 KB
/
entrypoint.sh
File metadata and controls
75 lines (62 loc) · 2.81 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
s=/mnt/vrising/server
p=/mnt/vrising/persistentdata
m=/mnt/vrising/mods
mkdir -p /root/.steam 2>&1
if [ -z "$SKIP_UPDATE" ] || [ ! -f "${s}/VRisingServer.exe" ]; then
if [ -n "$SKIP_UPDATE" ] && [ ! -f "${s}/VRisingServer.exe" ]; then
echo "[entrypoint] SKIP_UPDATE is set but server files are missing. Forcing update..."
fi
echo "[entrypoint] Updating V-Rising Dedicated Server files with steamcmd..."
if ! (r=5; while ! /usr/bin/steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "$s" +login anonymous +app_update 1829350 validate +quit ; do
((--r)) || exit
echo "[entrypoint] something went wrong, let's wait 5 seconds and retry"
rm -rf "${s}/steamapps"
sleep 5
done) ; then
echo "[entrypoint] failed updating with steamcmd!"
exit 1
fi
else
echo "[entrypoint] Skipping update as SKIP_UPDATE is set"
fi
if ! grep -q -o 'avx[^ ]*' /proc/cpuinfo; then
unsupported_file="VRisingServer_Data/Plugins/x86_64/lib_burst_generated.dll"
echo "[entrypoint] AVX or AVX2 not supported; Check if unsupported ${unsupported_file} exists.."
if [ -f "${s}/${unsupported_file}" ]; then
echo "[entrypoint] Changing ${unsupported_file} as attempt to fix issues..."
mv "${s}/${unsupported_file}" "${s}/${unsupported_file}.bak"
fi
fi
mkdir -p "$p/Settings"
if [ ! -f "$p/Settings/ServerGameSettings.json" ]; then
echo "[entrypoint] $p/Settings/ServerGameSettings.json not found. Copying default file..."
cp "$s/VRisingServer_Data/StreamingAssets/Settings/ServerGameSettings.json" "$p/Settings/" 2>&1
fi
if [ ! -f "$p/Settings/ServerHostSettings.json" ]; then
echo "[entrypoint] $p/Settings/ServerHostSettings.json not found. Copying default file..."
cp "$s/VRisingServer_Data/StreamingAssets/Settings/ServerHostSettings.json" "$p/Settings/" 2>&1
fi
echo "[entrypoint] Cleaning up old mods (if any).."
rm -rf "$s/BepInEx"
rm -rf "$s/dotnet"
rm -f "$s/doorstop_config.ini"
rm -f "$s/winhttp.dll"
if [ -n "$ENABLE_MODS" ]; then
echo "[entrypoint] Setting up mods..."
cp -r "$m/BepInEx" "$s/BepInEx"
cp -r "$m/dotnet" "$s/dotnet"
cp "$m/doorstop_config.ini" "$s/doorstop_config.ini"
cp "$m/winhttp.dll" "$s/winhttp.dll"
export WINEDLLOVERRIDES="winhttp=n,b"
fi
echo "[entrypoint] Starting V Rising Dedicated Server with name ${SERVERNAME=vrising-dedicated}..."
echo "[entrypoint] Trying to remove /tmp/.X0-lock..."
rm -f /tmp/.X0-lock 2>&1
echo "[entrypoint] Generating initial Wine configuration..."
winecfg
sleep 5
echo "[entrypoint] Starting Xvfb"
Xvfb :0 -screen 0 1024x768x16 &
echo "[entrypoint] Launching wine64 V Rising"
exec env DISPLAY=:0.0 wine64 /mnt/vrising/server/VRisingServer.exe -persistentDataPath $p -logFile "$p/$(date +%Y%m%d-%H%M)-VRisingServer.log" 2>&1