From ad06b04ecc0d03280a515eb7dd812271a8b92911 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 14 Aug 2023 12:12:05 -0400 Subject: [PATCH] added configuration functionality to make updates work correctly --- README.md | 4 +++- config.sh.example | 11 +++++++++++ start_server.sh | 11 ++--------- 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 config.sh.example diff --git a/README.md b/README.md index 5519e74..bd85622 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,9 @@ These three `.sh` files were created for Infern009's Factorio server, and use [B - Run the `start_server.sh` script. - If you haven't changed **Byobu's** configuration, you can detach from the terminal this spawns by pressing `Ctrl + A`, releasing those keys, then immediately pressing `D`. - Once the server is online, stop it with `/quit` from the Factorio server's console or by running the `stop_server.sh` script. -- Modify the parameters in `start_server.sh`. +- Copy the `config.sh.example` file. + - `cp config.sh.example config.sh` +- Modify the parameters in `config.sh`. - `save_name` - This parameter controls the name of the save file this script will use to start the server. - If you have modified any default config files except for the `config.ini`, you'll want to change the commands' parameters to match those files. I'll assume you're storing them in the `./data` directory. You can find more arguments on the [Factorio Wiki](https://wiki.factorio.com/Command_line_parameters). - `extra_params_create=""` - This parameter adds additional flags to the `--create` command the script runs if a save matching `save_name` is not found. diff --git a/config.sh.example b/config.sh.example new file mode 100644 index 0000000..4df435b --- /dev/null +++ b/config.sh.example @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +save_name="default" # Set this to the name of your save file. + +# Don't change this unless you know what you're doing. +# Set this to the custom parameters you want the --create command to use. +extra_params_create="" + +# Don't change this unless you know what you're doing. +# Set this to the custom parameters you want the --start_server command to use. +extra_params_start_server="" diff --git a/start_server.sh b/start_server.sh index 124d995..4efda6d 100644 --- a/start_server.sh +++ b/start_server.sh @@ -1,14 +1,7 @@ #!/usr/bin/env bash -save_name="default" # Set this to the name of your save file. - -# Don't change this unless you know what you're doing. -# Set this to the custom parameters you want the --create command to use. -extra_params_create="" - -# Don't change this unless you know what you're doing. -# Set this to the custom parameters you want the --start_server command to use. -extra_params_start_server="" +# Fetch variables from config.sh +source config.sh # Retrieves the script's directory and cd's into it. script_dir="$(cd "$(dirname "$0")" && pwd)"