fixed server_start to work properly if ran from another directory
This commit is contained in:
parent
489943b6a6
commit
6eb33b1aba
1 changed files with 15 additions and 15 deletions
|
@ -1,5 +1,20 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Retrieves the script's directory and cd's into it.
|
||||||
|
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.
|
||||||
|
echo "Updating scripts..."
|
||||||
|
git pull
|
||||||
|
echo "Scripts updated!"
|
||||||
|
echo "Server must be restarted for script updates to take effect."
|
||||||
|
else
|
||||||
|
echo "WARNING: This directory is not a Git repository. Script updates will not be automatically fetched."
|
||||||
|
fi
|
||||||
|
|
||||||
# If config.sh exists, fetch variables from it
|
# If config.sh exists, fetch variables from it
|
||||||
if [ -f "config.sh" ]; then
|
if [ -f "config.sh" ]; then
|
||||||
source config.sh
|
source config.sh
|
||||||
|
@ -18,21 +33,6 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Retrieves the script's directory and cd's into it.
|
|
||||||
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.
|
|
||||||
echo "Updating scripts..."
|
|
||||||
git pull
|
|
||||||
echo "Scripts updated!"
|
|
||||||
echo "Server must be restarted for script updates to take effect."
|
|
||||||
else
|
|
||||||
echo "WARNING: This directory is not a Git repository. Script updates will not be automatically fetched."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This handles automatically updating the Factorio binary.
|
# This handles automatically updating the Factorio binary.
|
||||||
echo "Fetching Factorio binary..."
|
echo "Fetching Factorio binary..."
|
||||||
wget https://factorio.com/get-download/stable/headless/linux64 -O factorio_headless.tar.xz
|
wget https://factorio.com/get-download/stable/headless/linux64 -O factorio_headless.tar.xz
|
||||||
|
|
Loading…
Reference in a new issue