added upgrade command, added support for release channels

This commit is contained in:
FezVrasta 2015-06-25 12:56:07 +02:00
parent 2652f5f752
commit 201c8879d6
4 changed files with 29 additions and 7 deletions

1
.version Normal file
View File

@ -0,0 +1 @@
1.2

View File

@ -4,21 +4,23 @@
# Net Installer, used with curl # 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 # Download and untar installation files
cd /tmp cd /tmp
wget https://github.com/FezVrasta/ark-server-tools/archive/master.tar.gz wget https://github.com/FezVrasta/ark-server-tools/archive/${channel}.tar.gz
tar -zxvf master.tar.gz tar -zxvf ${channel}.tar.gz
# Install ARK Server Tools # Install ARK Server Tools
cd ark-server-tools-master/tools cd ark-server-tools-${channel}/tools
chmod +x install.sh chmod +x install.sh
sh install.sh $1 > /dev/null sh install.sh $1 > /dev/null
status=$? status=$?
# Remove the installation files # Remove the installation files
rm -f master.tar.gz rm -f ${channel}.tar.gz
rm -rf /tmp/ark-server-tools-master rm -rf /tmp/ark-server-tools-${channel}
# Print messages # Print messages
case "$status" in case "$status" in

View File

@ -318,8 +318,23 @@ case "$1" in
status) status)
printStatus 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) -h|--help)
echo -e "Usage: arkmanager [OPTION]\n" echo -e "Usage: arkmanager[OPTION]\n"
echo "Option Description" echo "Option Description"
echo "start Starts the server" echo "start Starts the server"
echo "stop Stops the server" echo "stop Stops the server"
@ -330,9 +345,10 @@ case "$1" in
echo "checkupdate Check for a new ARK server version" echo "checkupdate Check for a new ARK server version"
echo "boradcast PLACEHOLDER, not supported yet" echo "boradcast PLACEHOLDER, not supported yet"
echo "status Returns the status of the current ARK server instance" 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." echo "Try 'arkmanager -h' or 'arkmanager --help' for more information."
;; ;;
esac esac

View File

@ -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 # config SteamCMD
steamcmdroot="/home/steam/steamcmd" # path of your steamcmd instance steamcmdroot="/home/steam/steamcmd" # path of your steamcmd instance
steamcmdexec="steamcmd.sh" # name of steamcmd executable steamcmdexec="steamcmd.sh" # name of steamcmd executable