added configuration functionality to make updates work correctly

This commit is contained in:
Seaswimmer 2023-08-14 12:12:05 -04:00
parent 74d0c543f2
commit ad06b04ecc
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8
3 changed files with 16 additions and 10 deletions

View file

@ -27,7 +27,9 @@ These three `.sh` files were created for Infern009's Factorio server, and use [B
- Run the `start_server.sh` script. - 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`. - 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. - 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. - `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). - 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. - `extra_params_create=""` - This parameter adds additional flags to the `--create` command the script runs if a save matching `save_name` is not found.

11
config.sh.example Normal file
View file

@ -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=""

View file

@ -1,14 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
save_name="default" # Set this to the name of your save file. # Fetch variables from config.sh
source config.sh
# 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=""
# Retrieves the script's directory and cd's into it. # Retrieves the script's directory and cd's into it.
script_dir="$(cd "$(dirname "$0")" && pwd)" script_dir="$(cd "$(dirname "$0")" && pwd)"