Skip to content

Instantly share code, notes, and snippets.

@andrelug
Last active September 3, 2015 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrelug/9d6fa9b90a02c447a413 to your computer and use it in GitHub Desktop.
Save andrelug/9d6fa9b90a02c447a413 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Net Installer, used with curl
#
channel=${2:-master} # if defined by 2nd argument install the defined version, otherwise install master
# Download and untar installation files
cd /mnt/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
version=`<../.version`
sed -i "s|^arkstVersion=\".*\"|arkstVersion='${version}'|" arkmanager
chmod +x install.sh
bash install.sh $1 > /dev/null
status=$?
rm -rf /mnt/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 $1!"
;;
"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 $1!"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment