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:
|
# 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
|
# 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
|
echo Save config.php
|
||||||
mv config.php config.php.keep
|
mv config.php config.php.keep
|
||||||
echo done!
|
echo done!
|
||||||
|
|
||||||
# remove old files except config.php.keep
|
# remove old files except config.php.keep
|
||||||
echo remove old files
|
echo Removing old files...
|
||||||
find . -type f ! -iname "*.keep" -delete
|
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
|
# unzip update file
|
||||||
echo latest Version is:
|
mv update.zip.keep update.zip
|
||||||
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.zip
|
unzip update.zip
|
||||||
|
|
||||||
# move all files and directories from new created phpservermon directory, to the directory above with the native phpservermon installation
|
# move all files and directories from new created phpservermon directory, to the directory above with the native phpservermon installation
|
||||||
mv phpservermon*/* .
|
mv phpservermon*/* .
|
||||||
# remove phpservermon directory
|
# remove phpservermon directory
|
||||||
rm -rf phpservermon*
|
rm -rf phpservermon*
|
||||||
|
# remove zip file
|
||||||
|
rm update.zip
|
||||||
# restore original config.php back from config.php.keep
|
# restore original config.php back from config.php.keep
|
||||||
mv config.php.keep config.php
|
mv config.php.keep config.php
|
||||||
|
|
||||||
|
@ -45,4 +48,4 @@ mv config.php.keep config.php
|
||||||
php composer.phar install
|
php composer.phar install
|
||||||
|
|
||||||
echo Update finished!
|
echo Update finished!
|
||||||
echo Please check the installation
|
echo Please finish the installation in your browser.
|
||||||
|
|
Loading…
Reference in New Issue