Skip to content

Commit

Permalink
Add env to toggle to automatically generate palworldsettings
Browse files Browse the repository at this point in the history
  • Loading branch information
MSpreckels committed Feb 9, 2024
1 parent c903120 commit 8e4b4ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ It is highly recommended you set the following environment values before startin
| DISCORD_PRE_START_MESSAGE | Discord message sent when server begins to start | Server is started! | "string" |
| DISCORD_PRE_SHUTDOWN_MESSAGE | Discord message sent when server begins to shutdown | Server is shutting down... | "string" |
| DISCORD_POST_SHUTDOWN_MESSAGE | Discord message sent when server has stopped | Server is stopped! | "string" |
| DISABLE_GENERATE_SETTINGS | Whether to automatically generate the PalWorldSettings.ini | false | true/false |

*highly recommended to set

Expand Down
25 changes: 23 additions & 2 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,30 @@ dirExists "/palworld" || exit
isWritable "/palworld" || exit
isExecutable "/palworld" || exit

printf "\e[0;32m*****GENERATING CONFIGS*****\e[0m\n"

./compile-settings.sh
if [ "${DISABLE_GENERATE_SETTINGS,,}" = false ]; then
printf "\e[0;32m*****GENERATING CONFIGS*****\e[0m\n"
./compile-settings.sh
else
printf "\e[0;32m%s\e[0m\n" "*****CHECKING FOR EXISTING CONFIG*****"

# shellcheck disable=SC2143
if [ ! "$(grep -s '[^[:space:]]' /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini)" ]; then

printf "\e[0;32m%s\e[0m\n" "*****GENERATING CONFIG*****"

# Server will generate all ini files after first run.
if [ "$architecture" == "arm64" ]; then
timeout --preserve-status 15s ./PalServer-arm64.sh 1> /dev/null
else
timeout --preserve-status 15s ./PalServer.sh 1> /dev/null
fi

# Wait for shutdown
sleep 5
cp /palworld/DefaultPalWorldSettings.ini /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
fi
fi

cd /palworld || exit

Expand Down

0 comments on commit 8e4b4ee

Please sign in to comment.