Update 02-init_steps.sh

This commit is contained in:
Alexandre
2023-03-23 23:44:47 +01:00
committed by GitHub
parent fe9587db28
commit b68fe449c2

View File

@@ -19,23 +19,24 @@ echo "Checking installation"
touch /reinstall
fi) &> /dev/null
# Check currently installed version
if [ -f /data/config/www/nextcloud/version.php ]; then
CURRENTVERSION="$(sed -n "s|.*\OC_VersionString = '*\(.*[^ ]\) *';.*|\1|p" /data/config/www/nextcloud/version.php)"
else
if [ -d /data/config/www/nextcloud ]; then rm -r /data/config/www/nextcloud; fi
CURRENTVERSION="$(cat /nextcloudversion)"
fi
# Reinstall if needed
if [ -f /reinstall ]; then
rm /reinstall
bashio::log.fatal "Issue with installation detected, reinstallation will proceed"
bashio::log.fatal "-------------------------------------------------------------."
bashio::log.fatal " "
# Check currently installed version
if [ -f /data/config/www/nextcloud/version.php ]; then
CURRENTVERSION="$(sed -n "s|.*\OC_VersionString = '*\(.*[^ ]\) *';.*|\1|p" /data/config/www/nextcloud/version.php)"
else
if [ -d /data/config/www/nextcloud ]; then rm -r /data/config/www/nextcloud; fi
CURRENTVERSION="$(cat /nextcloudversion)"
fi
# Redownload nextcloud if wrong version
if [[ ! "$CURRENTVERSION" == "$(cat /nextcloudversion)" ]]; then
bashio::log.fatal "Version installed is : $CURRENTVERSION and version bundled is : $ADDONVERSION, need to redownload files"
basio::log.fatal "Version installed is : $CURRENTVERSION and version bundled is : $ADDONVERSION, need to redownload files"
bashio::log.fatal "... download nextcloud version"
rm /app/nextcloud.tar.bz2
curl -o /app/nextcloud.tar.bz2 -L "https://download.nextcloud.com/server/releases/nextcloud-${CURRENTVERSION}.tar.bz2" --progress-bar || \
@@ -46,6 +47,17 @@ if [ -f /reinstall ]; then
rm /data/config/www/nextcloud/index.php
/./etc/s6-overlay/s6-rc.d/init-nextcloud-config/run
bashio::log.fatal "... done"
else
if [[ ! "$CURRENTVERSION" == "$(cat /nextcloudversion)" ]]; then
bashio::log.warning "Nexctloud $CURRENTVERSION is installed but $(cat /nextcloudversion) is in this container"
if bashio::config.true 'auto_updater'; then
bashio::log.warning "auto_updater configured, update starts now"
updater.phar
else
bashio::log.warning "auto_updater not set in addon options, please update from nextcloud settings"
fi
fi
fi
######################################