From 4eb2327b80bb81922c425ce8c41960d05f43d029 Mon Sep 17 00:00:00 2001 From: TimZ99 Date: Tue, 28 Aug 2018 13:42:55 +0200 Subject: [PATCH] Documentation and added check --- updater.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/updater.sh b/updater.sh index 0602e7dc..ab91af79 100755 --- a/updater.sh +++ b/updater.sh @@ -10,11 +10,26 @@ # used code: # cURL github API url: https://stackoverflow.com/questions/24987542/is-there-a-link-to-github-for-downloading-a-file-in-the-latest-release-of-a-repo +echo .......... PHPSERVERMON UPDATER .......... + +# check if updater is executed from within the phpservermon directory +if [ ! -f ./updater.sh ]; then + echo STOPPED: don\'t execute the updater from another directory! + exit +else + echo Start updating +fi + +# get latest version version=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep browser_download_url | cut -d '/' -f 8) echo Downloading latest Version of PHPServerMonitor \($version\) +# get download URL downloadfile=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep "zipball" | cut -d '"' -f 4) + +# download latest release wget -O update.zip.keep $downloadfile +# Check if wget is installed if ! [ $? -eq 0 ] then echo "wget not installed"