From 7704abb39db2150ee162c994bfc2379b71701e78 Mon Sep 17 00:00:00 2001 From: tueem Date: Mon, 21 Oct 2024 03:40:50 +0200 Subject: [PATCH] change variable names and directory to file check --- archean_start.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/archean_start.sh b/archean_start.sh index 4298296..241160b 100755 --- a/archean_start.sh +++ b/archean_start.sh @@ -1,24 +1,24 @@ #!/bin/bash -INI_DIRECTORY="Archean-data/server/server.ini" -ADMINS_DIRECTORY="Archean-data/server/admins.txt" +SERVER_INI="Archean-data/server/server.ini" +ADMINS_TXT="Archean-data/server/admins.txt" -if [ ! -d "$INI_DIRECTORY" ]; then - curl -o "$INI_DIRECTORY" --create-dirs https://git.tomatentum.net/tueem/archean-server-pelican/raw/branch/master/server.ini +if [ ! -e "$SERVER_INI" ]; then + curl -o "$SERVER_INI" --create-dirs https://git.tomatentum.net/tueem/archean-server-pelican/raw/branch/master/server.ini fi -echo "$ADMINS" > "$ADMINS_DIRECTORY" +echo "$ADMINS" > "$ADMINS_TXT" -sed -i "s/^game_mode=.*/game_mode=$( [ "$GAME_MODE" = "creative" ] && echo 0 || echo 1)/" "$INI_DIRECTORY" -sed -i "s/^server_online=.*/server_online=$( [ "$ONLINE_MODE" = "0" ] && echo no || echo yes)/" "$INI_DIRECTORY" -sed -i "s/^max_simultaneous_players=.*/max_simultaneous_players=$MAX_PLAYERS/" "$INI_DIRECTORY" -sed -i "s/^password=.*/password=$PASSWORD/" "$INI_DIRECTORY" -sed -i "s/^server_public_name=.*/server_public_name=$SERVER_NAME/" "$INI_DIRECTORY" -sed -i "s/^listen_port=.*/listen_port=$SERVER_PORT/" "$INI_DIRECTORY" -sed -i "s/^spawn=.*/spawn=$SPAWN_PLANET/" "$INI_DIRECTORY" -sed -i "s/^auto_save_interval_seconds=.*/auto_save_interval_seconds=$AUTOSAVE_INTERVAL/" "$INI_DIRECTORY" -sed -i "s/^updates_per_second=.*/updates_per_second=$UPDATES_PER_SECOND/" "$INI_DIRECTORY" -sed -i "s/^physics_steps_per_update=.*/physics_steps_per_update=$PHYSICS_UPDATES_PER_UPDATE/" "$INI_DIRECTORY" +sed -i "s/^game_mode=.*/game_mode=$( [ "$GAME_MODE" = "creative" ] && echo 0 || echo 1)/" "$SERVER_INI" +sed -i "s/^server_online=.*/server_online=$( [ "$ONLINE_MODE" = "0" ] && echo no || echo yes)/" "$SERVER_INI" +sed -i "s/^max_simultaneous_players=.*/max_simultaneous_players=$MAX_PLAYERS/" "$SERVER_INI" +sed -i "s/^password=.*/password=$PASSWORD/" "$SERVER_INI" +sed -i "s/^server_public_name=.*/server_public_name=$SERVER_NAME/" "$SERVER_INI" +sed -i "s/^listen_port=.*/listen_port=$SERVER_PORT/" "$SERVER_INI" +sed -i "s/^spawn=.*/spawn=$SPAWN_PLANET/" "$SERVER_INI" +sed -i "s/^auto_save_interval_seconds=.*/auto_save_interval_seconds=$AUTOSAVE_INTERVAL/" "$SERVER_INI" +sed -i "s/^updates_per_second=.*/updates_per_second=$UPDATES_PER_SECOND/" "$SERVER_INI" +sed -i "s/^physics_steps_per_update=.*/physics_steps_per_update=$PHYSICS_UPDATES_PER_UPDATE/" "$SERVER_INI" cd Archean-server-alpha ./Archean server \ No newline at end of file