Skip to content
Snippets Groups Projects
Verified Commit fd0d446e authored by David Beniamine's avatar David Beniamine
Browse files

Avoid upgrade preparation if no upgrade available

parent ac778714
No related branches found
No related tags found
No related merge requests found
...@@ -22,11 +22,44 @@ htuser=${htuser:-'www-data'} ...@@ -22,11 +22,44 @@ htuser=${htuser:-'www-data'}
ocupdater=${ocupdater:-"$NEXTCLOUD_INSTALL_DIR/updater/updater.phar"} ocupdater=${ocupdater:-"$NEXTCLOUD_INSTALL_DIR/updater/updater.phar"}
occ=$NEXTCLOUD_INSTALL_DIR/occ occ=$NEXTCLOUD_INSTALL_DIR/occ
APPS=`sudo -u $htuser php $occ app:list | awk 'BEGIN{ok=1} /^Disabled:/{ok=0} {if(ok==1){print $2}}' | sed 's/:$//'` APPS=`sudo -u $htuser php $occ app:list | awk 'BEGIN{ok=1} /^Disabled:/{ok=0} {if(ok==1){print $2}}' | sed 's/:$//'`
if [ ! -d $NEXTCLOUD_INSTALL_DIR ] if [ ! -d $NEXTCLOUD_INSTALL_DIR ]
then then
echo "Nextcloud is not installed, aborting" echo "Nextcloud is not installed, aborting"
exit 1 exit 1
fi fi
if [ -z $MAINTENANCE_LEVEL ]
then
echo "Maintenance level cannot be detected, please update your main.env"
exit 1
fi
current_vesion=`sudo -u www-data php /var/www/nextcloud/occ status \
| awk '/versionstring/{print $3}'`
echo "Nextclous is installed, version $current_vesion"
if [ $MAINTENANCE_LEVEL == "upgrade" ]
then
echo "Checking version from changelog page (upgrade)"
target_version=`curl -silent https://nextcloud.com/changelog/ \
| sed 's/>/>\n/g' | awk '/^<h3 id=/{print $2}' | head -n 1 \
| sed -e 's/id="\(.*\)">/\1/' -e 's/-/./g'`
else
echo "Checking version from install page (security)"
target_version=`curl -silent \
'https://nextcloud.com/install/#instructions-server' \
| sed 's/>/>\n/g' | awk '/href=.*server\/release/{print $0}' \
| head -n 1 | sed 's/.*nextcloud-\(.*\).zip">/\1/'`
fi
echo "Upstream version is : $target_version"
if [ "$current_vesion" == "$target_version" ]
then
echo "Nextcloud is already up to date"
exit 0
fi
echo "Removing old backup" echo "Removing old backup"
rm -rf $NEXTCLOUD_INSTALL_DIR.bak rm -rf $NEXTCLOUD_INSTALL_DIR.bak
echo "backing up nextcloud" echo "backing up nextcloud"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment