summarylogtreecommitdiffstats
path: root/factorio-headless.install
diff options
context:
space:
mode:
Diffstat (limited to 'factorio-headless.install')
-rw-r--r--factorio-headless.install13
1 files changed, 12 insertions, 1 deletions
diff --git a/factorio-headless.install b/factorio-headless.install
index bd82f5012451..7cdadb871c17 100644
--- a/factorio-headless.install
+++ b/factorio-headless.install
@@ -2,11 +2,22 @@ post_install() {
systemd-sysusers factorio.conf
[[ -d /var/lib/factorio ]] || install -dm 770 -o factorio -g games /var/lib/factorio
+ source /etc/conf.d/factorio
+
# create empty game
- [[ -f /var/lib/factorio/.factorio/saves/factorio-service-save.zip ]] || su - factorio -s /bin/sh -c 'factorio --create /var/lib/factorio/.factorio/saves/factorio-service-save.zip 2>&1 >/dev/null'
+ if [[ ! -f "$SAVE_FILE" ]]; then
+ echo "Generating initial save file: $SAVE_FILE"
+ su - factorio -s /bin/sh -c "factorio --create '$SAVE_FILE' 2>&1 >/dev/null"
+ fi
}
post_upgrade() {
(( $(vercmp $2 '0.12.26-4') < 0 )) && chown -R root:root /usr/share/factorio || true
(( $(vercmp $2 '0.12.26-4') < 0 )) && post_install "$1" || true
+ (( $(vercmp $2 '0.14.12-1') < 0 )) && {
+ echo "AUTOSAVE_INTERVAL and AUTOSAVE_SLOTS must now be declared in /etc/factorio/server-settings.json"
+ echo "Please update /etc/factorio/server-settings.json and /etc/conf.d/factorio now."
+ echo
+ echo "The systemd service file has been updated, don't forget to run 'systemctl daemon-reload' before restarting factorio."
+ } || true
}