factorio-mod-updater
factorio-mod-updater copied to clipboard
Python script to update mods on a dedicated factorio server
trafficstars
This module will automatically update all mods installed for a given instance of Factorio.
Note that this is primarily intended for headless dedicated Linux servers.
Features
- Updates mods to the latest release based on mod-list.json
- Removes all old versions of mods which are being updated
- Limits releases to those compatible with the installed factorio version
- Installs all required dependencies for the latest release of the currently enabled mods
Installation
-
Ensure a python3 implementation is available via something like
command -v python3. If it's missing here's a few potential installation routes:Ubuntu/Debian
sudo apt install python3 -yRedHat Family (Fedora/CentOS/etc)
sudo yum install python36u -yGentoo
# Shouldn't be necessary since you'll have python for portage emerge -vt python -
Install requests as described in their documentation. Or, on gentoo:
emerge -vt dev-python/requests -
Download the latest release and you should be good to go.
Usage
Two modes are supported:
--list- lists all mods described by mod-list.json, their current version, and the latest release--update- performs an update of all mods for the current server
Here's a brief example of executing the command:
./mod_updater.py -s /opt/factorio/data/server-settings.json \
-m /opt/factorio/mods \
--fact-path /opt/factorio/bin/x64/factorio --update
Contributing
A few notes about the code:
- This script is designed to work with Python 3. Although there will be effort to avoid needlessly bumping the required version of Python 3, changes to make the script work on end-of-life versions of Python 3 are not supported.
- To ensure consistency in the code, format with
blackbefore submitting pull requests. You can install black withpip install blackand then runblack mod_updater.pyin the repo to autoformat. - On a best-effort basis, the script should pass all lints on
flake8andpylint. You can also install these via pip and can run them withflake8 mod_updater.pyandpylint mod_updater.pyrespectively.