Skip to content

Instantly share code, notes, and snippets.

@mickael9
Last active November 5, 2016 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickael9/8dd500eb6e8feadc68cb045e83817f8d to your computer and use it in GitHub Desktop.
Save mickael9/8dd500eb6e8feadc68cb045e83817f8d to your computer and use it in GitHub Desktop.
diff --git a/.SRCINFO b/.SRCINFO
index b3c3f2d..84f7b7c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,8 @@
# Generated by mksrcinfo v8
-# Wed Aug 17 22:10:04 UTC 2016
+# Thu Nov 3 16:22:43 UTC 2016
pkgbase = factorio-headless-experimental
pkgdesc = A 2D game about building and maintaining factories - Server version (experimental branch)
- pkgver = 0.13.17
+ pkgver = 0.14.18
pkgrel = 1
url = http://www.factorio.com/
install = factorio-headless.install
@@ -14,16 +14,17 @@ pkgbase = factorio-headless-experimental
conflicts = factorio-experimental
options = !strip
backup = etc/conf.d/factorio
+ backup = etc/factorio/server-settings.json
source = LICENSE
source = factorio-headless.service
source = factorio-headless.conf
source = factorio-headless.sysusers
- source = factorio_headless_x64_0.13.17.tar.gz::http://www.factorio.com/get-download/0.13.17/headless/linux64
+ source = factorio_headless_x64_0.14.18.tar.gz::http://www.factorio.com/get-download/0.14.18/headless/linux64
sha256sums = 67ec2f88afff5d7e0ca5fd3301b5d98655269c161a394368fa0ec49fbc0c0e21
- sha256sums = c4b2b0f7aa32cc2bf1e662a811b73802ea2040ad3a7b9c973d36b6025a245e4e
- sha256sums = d0f658296d77052b332a5f5ab940cd77b9d00deebc86eaf669d3ad86c0356aa4
+ sha256sums = 7416d16874f9f80ba82e433d0f2af1acbaf2b6e625eee8a68cd929424bfcba6b
+ sha256sums = c92b63cb77db2ded41d28cbe82bb99778c010b92758786683eef64fdd244937c
sha256sums = 87dae15d1bcfb4683faea9c66498bd916bd27f8aa0dc724c4e21076dcf17da64
- sha256sums = e70ad9ca3aba6a4cc2043f7e965c01212ae4bf38b93469036443f7d4c271afa9
+ sha256sums = b5e3a57e4d4899388d1318295bce396591ce47907520087e578f18e0ad096448
pkgname = factorio-headless-experimental
diff --git a/PKGBUILD b/PKGBUILD
index 78ce13d..68c1a04 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
# Inspiration for service and config files: https://github.com/Bisa/factorio-init
pkgname=factorio-headless-experimental
-pkgver=0.13.17
+pkgver=0.14.18
pkgrel=1
pkgdesc="A 2D game about building and maintaining factories - Server version (experimental branch)"
arch=('x86_64')
@@ -12,7 +12,10 @@ license=('custom: commercial')
conflicts=('factorio' 'factorio-demo' 'factorio-headless' 'factorio-experimental')
install=factorio-headless.install
options=(!strip)
-backup=(etc/conf.d/factorio)
+backup=(etc/conf.d/factorio
+ etc/factorio/server-settings.json
+)
+
source=(LICENSE
factorio-headless.service
factorio-headless.conf
@@ -21,10 +24,10 @@ source=(LICENSE
)
sha256sums=('67ec2f88afff5d7e0ca5fd3301b5d98655269c161a394368fa0ec49fbc0c0e21'
- 'c4b2b0f7aa32cc2bf1e662a811b73802ea2040ad3a7b9c973d36b6025a245e4e'
- 'd0f658296d77052b332a5f5ab940cd77b9d00deebc86eaf669d3ad86c0356aa4'
+ '7416d16874f9f80ba82e433d0f2af1acbaf2b6e625eee8a68cd929424bfcba6b'
+ 'c92b63cb77db2ded41d28cbe82bb99778c010b92758786683eef64fdd244937c'
'87dae15d1bcfb4683faea9c66498bd916bd27f8aa0dc724c4e21076dcf17da64'
- 'e70ad9ca3aba6a4cc2043f7e965c01212ae4bf38b93469036443f7d4c271afa9')
+ 'b5e3a57e4d4899388d1318295bce396591ce47907520087e578f18e0ad096448')
# no modifications needed, the executable looks for:
@@ -40,4 +43,8 @@ package() {
install -Dm644 "${srcdir}/factorio-headless.sysusers" "$pkgdir/usr/lib/sysusers.d/factorio.conf"
install -Dm644 "${srcdir}/factorio-headless.conf" "${pkgdir}/etc/conf.d/factorio"
install -Dm644 "${srcdir}/factorio-headless.service" "${pkgdir}/usr/lib/systemd/system/factorio.service"
+ install -Dm644 "${srcdir}/factorio/data/server-settings.example.json" "${pkgdir}/etc/factorio/server-settings.json"
+
+ # public isn't really a good default especially with the default name/description
+ sed -i 's/^ "public": true/ "public": false/' "${pkgdir}/etc/factorio/server-settings.json"
}
diff --git a/factorio-headless.conf b/factorio-headless.conf
index 96d3404..0d6b5a5 100644
--- a/factorio-headless.conf
+++ b/factorio-headless.conf
@@ -1,15 +1,13 @@
-# The latency expected between peers (milliseconds)
-# Try to set this to the highest latency + 30
-# If peers A and B have a latency of 100 between each other, set this to 130
-LATENCY=250
-
-# The number of minutes between each autosave
-AUTOSAVE_INTERVAL=10
-# The number of autosaves to use for rotation
-AUTOSAVE_SLOTS=3
-
-# Additional factorio arguments
-FACTORIO_EXTRA_ARGS="--allow-commands=restrict"
+# AUTOSAVE_INTERVAL and AUTOSAVE_SLOTS must now be declared in /etc/factorio/server-settings.json
# Save file (no .zip suffix)
SAVE_NAME=factorio-service-save
+
+# Additional factorio arguments, such as:
+# -v [ --verbose ] enable verbose logging
+# --mod-directory PATH Mod directory to use
+# --port N network port to use
+# --rcon-port N Port to use for RCON
+# --rcon-password PASSWORD Password for RCON
+
+FACTORIO_EXTRA_ARGS=""
diff --git a/factorio-headless.install b/factorio-headless.install
index bd4ec71..9dd9423 100644
--- a/factorio-headless.install
+++ b/factorio-headless.install
@@ -11,4 +11,9 @@ post_install() {
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/config.d/factorio now."
+ echo "Don't forget to run 'systemctl daemon-reload' before restarting your server."
+ } || true
}
diff --git a/factorio-headless.service b/factorio-headless.service
index 66bf96a..66cbbaf 100644
--- a/factorio-headless.service
+++ b/factorio-headless.service
@@ -8,7 +8,7 @@ User=factorio
EnvironmentFile=/etc/conf.d/factorio
WorkingDirectory=/var/lib/factorio
TimeoutStartSec=5
-ExecStart=/usr/bin/factorio --start-server ${SAVE_NAME}.zip --autosave-interval $AUTOSAVE_INTERVAL --autosave-slots $AUTOSAVE_SLOTS --latency-ms $LATENCY $FACTORIO_EXTRA_ARGS
+ExecStart=/usr/bin/factorio --server-settings /etc/factorio/server-settings.json --start-server ${SAVE_NAME}.zip $FACTORIO_EXTRA_ARGS
TimeoutStopSec=10
KillSignal=SIGINT
RestartSec=10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment