Skip to content

Latest commit

 

History

History
97 lines (75 loc) · 3.59 KB

README.md

File metadata and controls

97 lines (75 loc) · 3.59 KB

Factorio Init Script

A factorio init script for linux

Dependencies

Among others:

  • cURL

Debugging

If you find yourself wondering why stuff is not working the way you expect:

  • Check the logs, I suggest you tail -f /opt/factorio/factorio-current.log in a separate session
  • Enable debugging in the config and/or:
  • Try running the same commands as the factorio user (/opt/factorio-init/factorio invocation will tell you what the factorio user tries to run at start)
$ /opt/factorio-init/factorio invocation
#  Run this as the factorio user, example:
$ sudo -u factorio 'whatever invocation gave you'
# You should see some output in your terminal here, hopefully giving
# you a hint of what is going wrong

Install

  • Create a directory where you want to store this script along with configuration. (either copy-paste the files or clone from github):
$ cd '/opt'
$ git clone https://github.com/Bisa/factorio-init.git
  • Rename config.example to config and modify the values within according to your setup.

Notes for users with an OS that has a older glibc version:

First-run

  • If you don't have Factorio installed already, use the install command:
$ /opt/factorio-init/factorio install  # see help for options
  • The installation routine creates Factorio's config.ini automatically.

  • If you previously ran Factorio without this script, the existing config.ini should work fine.

Autocompletion

  • Copy/Symlink or source the bash_autocompletion file
$ ln -s /opt/factorio-init/bash_autocomplete /etc/bash_completion.d/factorio
# OR:
$ echo "source /opt/factorio-init/bash_autocomplete" >> ~/.bashrc
# restart your shell to verify that it worked

Systemd

  • Copy the example service, adjust & reload
$ cp /opt/factorio-init/factorio.service.example /etc/systemd/system/factorio.service
# Edit the service file to suit your environment then reload systemd
$ systemctl daemon-reload
  • Verify that the server starts
$ systemctl start factorio
$ systemctl status -l factorio
# Remember to enable the service at startup if you want that:
$ systemctl enable factorio

SysvInit

  • Symlink the init script:
$ ln -s /opt/factorio-init/factorio /etc/init.d/factorio
# Make the script executable:
$ chmod +x /opt/factorio-init/factorio
# Try it out:
$ service factorio help
# Do not forget to enable the service at boot if you want that.

Thank You

  • To all who find this script useful in one way or the other
  • A big thank you to Wube for making Factorio
  • A special thanks to NoPantsMcDance, Oxyd, HanziQ, TheFactorioCube and all other frequent users of the #factorio channel @ esper.net
  • Thank you to Salzig for pointing me in the right direction when it comes to input redirection
  • At last, but not least; Thank you to all contributors and users posting issues in my github project or on the factorio forums

You are all a great source of motivation, thank you.

License

This code is realeased with the MIT license, see the LICENSE file.