mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-11 10:38:27 +00:00
67 lines
1.8 KiB
Bash
67 lines
1.8 KiB
Bash
#!/bin/bash
|
|
|
|
#
|
|
# Net Installer, used with curl
|
|
#
|
|
|
|
steamcmd_user="$1"
|
|
channel=${2:-master} # if defined by 2nd argument install the defined version, otherwise install master
|
|
shift
|
|
shift
|
|
|
|
output=/dev/null
|
|
|
|
if [ "$1" = "--verbose" ]; then
|
|
output=/dev/fd/1
|
|
shift
|
|
elif [[ "$1" =~ ^--output= ]]; then
|
|
output="${1#--output=}"
|
|
shift
|
|
fi
|
|
|
|
# Download and untar installation files
|
|
cd /tmp
|
|
COMMIT="`curl -L -k -s https://api.github.com/repos/FezVrasta/ark-server-tools/git/refs/heads/${channel} | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"
|
|
|
|
if [ -z "$COMMIT" ]; then
|
|
if [ "$channel" != "master" ]; then
|
|
echo "Channel ${channel} not found - trying master"
|
|
channel=master
|
|
COMMIT="`curl -L -k -s https://api.github.com/repos/FezVrasta/ark-server-tools/git/refs/heads/${channel} | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"
|
|
fi
|
|
fi
|
|
|
|
if [ -z "$COMMIT" ]; then
|
|
echo "Unable to retrieve latest commit"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir ark-server-tools-${channel}
|
|
cd ark-server-tools-${channel}
|
|
curl -L -k -s https://github.com/FezVrasta/ark-server-tools/archive/${COMMIT}.tar.gz | tar xz
|
|
|
|
# Install ARK Server Tools
|
|
cd ark-server-tools-${COMMIT}/tools
|
|
sed -i "s|^arkstCommit='.*'$|arkstCommit='${COMMIT}'|" arkmanager
|
|
chmod +x install.sh
|
|
bash install.sh "$steamcmd_user" "$@" >"$output" 2>&1
|
|
|
|
status=$?
|
|
|
|
rm -rf /tmp/ark-server-tools-${channel}
|
|
|
|
# Print messages
|
|
case "$status" in
|
|
"0")
|
|
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!"
|
|
;;
|
|
|
|
"1")
|
|
echo "Something where wrong :("
|
|
;;
|
|
"2")
|
|
echo "WARNING: A previous version of ARK Server Tools was detected in your system, your old configuration was not overwritten. You may need to manually update it."
|
|
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!"
|
|
;;
|
|
esac
|