From 74d0c543f2da496ad6e92c60adb69f8a1d26b0cc Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 14 Aug 2023 12:05:57 -0400 Subject: [PATCH] added autoupdating for scripts --- start_server.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/start_server.sh b/start_server.sh index 12a15bb..124d995 100644 --- a/start_server.sh +++ b/start_server.sh @@ -14,6 +14,15 @@ extra_params_start_server="" script_dir="$(cd "$(dirname "$0")" && pwd)" cd ${script_dir} +# Check if the current directory is inside a Git repository. +if [ -d .git ] || git rev-parse --is-inside-work-tree > /dev/null 2>&1 ; then + # Pull updated scripts from CoastalCommits. + git pull +else + # The current directory is not part of a Git repository. + echo "WARNING: This directory is not a Git repository. Script updates will not be automatically fetched." +fi + # This handles automatically updating the Factorio binary. wget https://factorio.com/get-download/stable/headless/linux64 -O factorio_headless.tar.xz tar -xf factorio_headless.tar.xz --strip-components=1 --overwrite @@ -30,4 +39,4 @@ byobu new-session -d -s factorio "./bin/x64/factorio ${extra_params_start_server # This attaches the current terminal to the byobu session. # Comment this out if you don't want this functionality. -byobu attach -t factorio \ No newline at end of file +byobu attach -t factorio