Download before removing
Remove vendor directory. Moved removing files until after checking if wget is installed.pull/620/head
parent
67a8a72779
commit
ab7cc78fbb
35
updater.sh
35
updater.sh
|
@ -10,34 +10,37 @@
|
|||
# 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
|
||||
|
||||
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\)
|
||||
|
||||
downloadfile=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep "zipball" | cut -d '"' -f 4)
|
||||
wget -O update.zip.keep $downloadfile
|
||||
if ! [ $? -eq 0 ]
|
||||
then
|
||||
echo "wget not installed"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Save config.php
|
||||
mv config.php config.php.keep
|
||||
echo done!
|
||||
|
||||
# remove old files except config.php.keep
|
||||
echo remove old files
|
||||
echo Removing old files...
|
||||
find . -type f ! -iname "*.keep" -delete
|
||||
rm -rf cron/ docs/ puphpet/ src/ static/
|
||||
rm -rf cron/ docs/ puphpet/ src/ static/ vendor/
|
||||
echo OK
|
||||
|
||||
echo Download latest Version of PHPServerMonitor
|
||||
echo latest Version is:
|
||||
curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep browser_download_url | cut -d '/' -f 8
|
||||
|
||||
|
||||
#Set if question whether ready to proceed update
|
||||
echo Do you want download the update and install? Y/N
|
||||
|
||||
#extract url from latest zip file to download
|
||||
downloadfile=$(curl -s https://api.github.com/repos/phpservermon/phpservermon/releases/latest | grep "zipball" | cut -d '"' -f 4)
|
||||
|
||||
#download latest version zip file and save it with wget as update.zip
|
||||
wget -O update.zip "$downloadfile"
|
||||
# unzip update file
|
||||
mv update.zip.keep update.zip
|
||||
unzip update.zip
|
||||
|
||||
# move all files and directories from new created phpservermon directory, to the directory above with the native phpservermon installation
|
||||
mv phpservermon*/* .
|
||||
# remove phpservermon directory
|
||||
rm -rf phpservermon*
|
||||
# remove zip file
|
||||
rm update.zip
|
||||
# restore original config.php back from config.php.keep
|
||||
mv config.php.keep config.php
|
||||
|
||||
|
@ -45,4 +48,4 @@ mv config.php.keep config.php
|
|||
php composer.phar install
|
||||
|
||||
echo Update finished!
|
||||
echo Please check the installation
|
||||
echo Please finish the installation in your browser.
|
||||
|
|
Loading…
Reference in New Issue