-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·37 lines (27 loc) · 1.1 KB
/
entrypoint.sh
File metadata and controls
executable file
·37 lines (27 loc) · 1.1 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
#!/bin/sh
init_config() {
jq_cmd='.'
if [ -n "$RCON_PASS" ]; then
jq_cmd="${jq_cmd} | .rcon_pass = \"$RCON_PASS\""
echo "Factorio rcon password is '$RCON_PASS'"
fi
jq_cmd="${jq_cmd} | .sq_lite_database_file = \"/opt/fsm-data/sqlite.db\""
jq_cmd="${jq_cmd} | .log_file = \"/opt/fsm-data/factorio-server-manager.log\""
jq_cmd="${jq_cmd} | .factorio_credentials_file = \"/opt/fsm-data/factorio.auth\""
jq_cmd="${jq_cmd} | .mod_pack_dir = \"/opt/fsm-data/mod_packs\""
jq "${jq_cmd}" /opt/fsm/conf.json >/opt/fsm-data/conf.json
}
random_pass() {
LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w 24 | head -n 1
}
install_game() {
curl --location "https://www.factorio.com/get-download/${FACTORIO_VERSION}/headless/linux64" \
--output /tmp/factorio_${FACTORIO_VERSION}.tar.xz
tar -xf /tmp/factorio_${FACTORIO_VERSION}.tar.xz
rm /tmp/factorio_${FACTORIO_VERSION}.tar.xz
}
if [ ! -f /opt/fsm-data/conf.json ]; then
init_config
fi
install_game
cd /opt/fsm && ./factorio-server-manager --conf /opt/fsm-data/conf.json --dir /opt/factorio --port 80