From 201c8879d6fbf8e777767bfee806a4fa5bb636a5 Mon Sep 17 00:00:00 2001 From: FezVrasta Date: Thu, 25 Jun 2015 12:56:07 +0200 Subject: [PATCH] added upgrade command, added support for release channels --- .version | 1 + netinstall.sh | 12 +++++++----- tools/arkmanager | 20 ++++++++++++++++++-- tools/arkmanager.cfg | 3 +++ 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 .version diff --git a/.version b/.version new file mode 100644 index 0000000..ea710ab --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.2 \ No newline at end of file diff --git a/netinstall.sh b/netinstall.sh index b0907c3..e373191 100644 --- a/netinstall.sh +++ b/netinstall.sh @@ -4,21 +4,23 @@ # 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 /tmp -wget https://github.com/FezVrasta/ark-server-tools/archive/master.tar.gz -tar -zxvf master.tar.gz +wget https://github.com/FezVrasta/ark-server-tools/archive/${channel}.tar.gz +tar -zxvf ${channel}.tar.gz # Install ARK Server Tools -cd ark-server-tools-master/tools +cd ark-server-tools-${channel}/tools chmod +x install.sh sh install.sh $1 > /dev/null status=$? # Remove the installation files -rm -f master.tar.gz -rm -rf /tmp/ark-server-tools-master +rm -f ${channel}.tar.gz +rm -rf /tmp/ark-server-tools-${channel} # Print messages case "$status" in diff --git a/tools/arkmanager b/tools/arkmanager index 4fe34f8..9bbfd2c 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -318,8 +318,23 @@ case "$1" in status) printStatus ;; + upgrade) + echo "arkmanager v${arkstVersion}: Checking for updates... + arkstLatestVersion=`curl -s https://raw.githubusercontent.com/FezVrasta/ark-server-tools/${arkstChannel}/.version` + if [ $arkstLatestVersion -gt $arkstVersion ]; then + read -p "A new version was found! Do you want to upgrade ARK Server Tools to v${$arkstLatestVersion}?" -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + curl -s https://raw.githubusercontent.com/FezVrasta/ark-server-tools/${arkstChannel}/netinstall.sh | sudo bash -s ${steamcmd_user} ${arkstChannel} + else + exit 0 + fi + else + echo "Your ARK server tools are already up to date" + fi + ;; -h|--help) - echo -e "Usage: arkmanager [OPTION]\n" + echo -e "Usage: arkmanager[OPTION]\n" echo "Option Description" echo "start Starts the server" echo "stop Stops the server" @@ -330,9 +345,10 @@ case "$1" in echo "checkupdate Check for a new ARK server version" echo "boradcast PLACEHOLDER, not supported yet" echo "status Returns the status of the current ARK server instance" + echo "upgrade Check for a new ARK Server Tools version and upgrades it if needed" ;; *) - echo "arkmanager: no command specified" + echo "arkmanager v${arkstVersion}: no command specified" echo "Try 'arkmanager -h' or 'arkmanager --help' for more information." ;; esac diff --git a/tools/arkmanager.cfg b/tools/arkmanager.cfg index b0571d1..3e7ce29 100644 --- a/tools/arkmanager.cfg +++ b/tools/arkmanager.cfg @@ -1,3 +1,6 @@ +arkstVersion="1.2" # used to print the version when needed and to check for updates +arkstChannel="master" # change it to a different branch to get non-stable versions + # config SteamCMD steamcmdroot="/home/steam/steamcmd" # path of your steamcmd instance steamcmdexec="steamcmd.sh" # name of steamcmd executable