forked from michael-lawrence/docker-starbound-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
62 lines (53 loc) · 1.82 KB
/
start.sh
File metadata and controls
62 lines (53 loc) · 1.82 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
#!/bin/bash
if [ -v CLEANUP_MODS ] && [ $CLEANUP_MODS == "false" ]; then
cleanmods=0
else
cleanmods=1
fi
echo "Installing/updating Starbound"
/steamcmd-2fa --path /bin/steamcmd --username $STEAM_USER --password $STEAM_PASSWORD --secret $STEAM_SECRET --args "+app_update 211820 validate +quit"
echo "Installation/update command completed. Could be continuing in background though."
cd /root/.steam/SteamApps/workshop/content/211820
echo "Copying new/updated mod(s) to /mods directory"
declare -i subscribedmods=0
for mod in $(ls)
do
echo "$mod found in workshop folder. Copying to /mods folder if needed"
cp -u $mod/contents.pak /mods/$mod.pak
subscribedmods=$(( subscribedmods + 1 ))
done
echo "New/updated mod(s) copy completed"
echo "$subscribedmods mods subscribed to"
echo "Removing mods_go_here file if it exists"
file=/mods/mods_go_here
if [ -f "$file" ]; then
rm "$file"
echo "mods_go_here file removed"
else
echo "mods_go_here file does not exist"
fi
echo "Checking installed mods"
declare -i installedmods=0
cd /mods
installedmods=$(ls -1 | wc -l)
echo "$installedmods mods installed"
if [ $cleanmods -eq 1 ] && [ $installedmods -gt $subscribedmods ]; then
echo "Mod(s) need to be uninstalled"
for pak in $(ls)
do
tmpmod=${pak%.pak}
if [ ! -d "/root/.steam/SteamApps/workshop/content/211820/$tmpmod" ]; then
echo "Not subscribed to $tmpmod. Removing"
rm "$pak"
else
echo "Subscribed to $tmpmod"
fi
done
elif [ $cleanmods -eq 1 ]; then
echo "Subscribed mod(s) and installed mod(s) match. No cleanup required"
else
echo "CLEANUP_MODS parameter was set to false so no check was performed to see if mod(s) should be uninstalled"
fi
cd /root/.steam/SteamApps/common/Starbound/linux
echo "Starting server"
./starbound_server