-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstart.sh
executable file
·52 lines (40 loc) · 1.27 KB
/
start.sh
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
#!/usr/bin/env bash
set -e
function init_srv(){
echo "===== SETTING UP SCREEPS ====="
cp -a /screeps.base/* /screeps/
cd /screeps
if [ -z "$STEAM_KEY" ]; then
echo "Did you forget to set the STEAM_KEY environment variable?"
exit 1
else
echo "initializing .screepsrc..."
yarn init -y
yarn add screeps
# pass our steam key into the init process
echo "${STEAM_KEY}" | npx screeps init
fi
sed -i 's/modfile.*/modfile = custom_mods.json/' .screepsrc
sed -i 's/storage_disabled = false/storage_disabled = true/' .screepsrc
# Add newline to .screepsrc if not already ending with newline
[ -n "$(tail -c1 .screepsrc)" ] && echo >> .screepsrc
echo -e "\n[mongo]" >> .screepsrc
echo -e "host=${MONGO_LINK:=mongo}" >> .screepsrc
echo -e "[redis]" >> .screepsrc
echo -e "host=${REDIS_LINK:=redis}" >> .screepsrc
}
function run_srv(){
cd /screeps
exec npx screeps start
}
case $1 in
init)
init_srv
;;
run)
run_srv
;;
*)
exec "$@"
;;
esac