Last active
February 14, 2024 13:03
-
-
Save bskinner/55710a05b1d4ffc4cae00c132811b20a to your computer and use it in GitHub Desktop.
Launch factorio server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
PREFIX="$HOME" | |
FACTORIO_CFG="$PREFIX/.factorio" | |
WORLD_NAME="my-world-name" | |
WORLD_PATH="$FACTORIO_CFG/$WORLD_NAME" | |
SERVER_SETTINGS="$WORLD_PATH/server-settings.json" | |
SAVE_ARCHIVE="$WORLD_NAME.zip" | |
FACTORIO_HOME="$PREFIX/factorio" | |
FACTORIO_BIN="$FACTORIO_HOME/bin/x64/factorio" | |
FACTORIO_UPDATER_HOME="$PREFIX/factorio-updater" | |
FACTORIO_UPDATER="$FACTORIO_UPDATER_HOME/update_factorio.py" | |
FACTORIO_UPDATER_HOME="$PREFIX/factorio-updater" | |
FACTORIO_UPDATER="$FACTORIO_UPDATER_HOME/update_factorio.py" | |
( | |
python3 "$FACTORIO_UPDATER" \ | |
--credentials "$SERVER_SETTINGS" \ | |
--package "core-linux_headless64" \ | |
--apply-to "$FACTORIO_BIN" \ | |
--delete-after-applying | |
) | |
update_ec=$? | |
case $update_ec in | |
0) | |
echo "Update successfull." | |
;; | |
2) | |
echo "No update available." | |
;; | |
*) | |
echo "Factorio updater failed" | |
exit $update_ec | |
;; | |
esac | |
MOD_UPDATER_VERSION="0.2.4" | |
MOD_UPDATER_HOME="$PREFIX/factorio-mod-updater-$MOD_UPDATER_VERSION" | |
"$MOD_UPDATER_HOME/mod_updater.py" -s "$SERVER_SETTINGS" \ | |
-m "$FACTORIO_HOME/mods" \ | |
--fact-path "$FACTORIO_BIN" --update | |
"$FACTORIO_BIN" \ | |
--port 34197 \ | |
--bind "0.0.0.0" \ | |
--server-settings "$SERVER_SETTINGS" \ | |
--start-server "$WORLD_PATH/saves/$SAVE_ARCHIVE" \ | |
--use-authserver-bans \ | |
--server-adminlist "$WORLD_PATH/adminlist.json" \ | |
--server-banlist "$WORLD_PATH/banlist.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment