Update 02-init_steps.sh

This commit is contained in:
Alexandre
2023-03-25 08:01:00 +01:00
committed by GitHub
parent 07855ac060
commit ad8609950b

View File

@@ -32,16 +32,16 @@ done
CONTAINERVERSION="$(cat /nextcloudversion)"
if [ -f /data/config/www/nextcloud/version.php ]; then
CURRENTVERSION="$(sed -n "s|.*\OC_VersionString = '*\(.*[^ ]\) *';.*|\1|p" /data/config/www/nextcloud/version.php)"
bashio::log.info "--------------------------------------"
bashio::log.info "Nextcloud $CURRENTVERSION is installed"
bashio::log.info "--------------------------------------"
bashio::log.green "--------------------------------------"
bashio::log.green "Nextcloud $CURRENTVERSION is installed"
bashio::log.green "--------------------------------------"
else
if [ -d /data/config/www/nextcloud ]; then rm -r /data/config/www/nextcloud; fi
CURRENTVERSION="$CONTAINERVERSION"
bashio::log.warning "--------------------------------------------------------------------------------------------------------------"
bashio::log.warning "Nextcloud not installed, please wait for addon startup, login Webui, install Nextcloud, then restart the addon"
bashio::log.warning "--------------------------------------------------------------------------------------------------------------"
bashio::log.warning " "
bashio::log.green "--------------------------------------------------------------------------------------------------------------"
bashio::log.yellow "Nextcloud not installed, please wait for addon startup, login Webui, install Nextcloud, then restart the addon"
bashio::log.green "--------------------------------------------------------------------------------------------------------------"
bashio::log.green " "
exit 0
fi
@@ -52,14 +52,14 @@ fi
# Inform if new version available
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if [ "$(version "$CONTAINERVERSION")" -gt "$(version "$CURRENTVERSION")" ]; then
bashio::log.warning " "
bashio::log.warning "New version available : $CONTAINERVERSION"
bashio::log.yellow " "
bashio::log.yellow "New version available : $CONTAINERVERSION"
if bashio::config.true 'auto_updater'; then
if [[ $((CONTAINERVERSION-CURRENTVERSION)) = 1 ]]; then echo "nok"; fi
bashio::log.warning "... auto_updater configured, update starts now"
bashio::log.green "... auto_updater configured, update starts now"
updater.phar &>/proc/1/fd/1
else
bashio::log.warning "...auto_updater not set in addon options, please update from nextcloud settings"
bashio::log.yellow "...auto_updater not set in addon options, please update from nextcloud settings"
fi
fi
@@ -68,7 +68,7 @@ fi
######################
# Check if issue in installation
bashio::log.info "Checking installation"
bashio::log.green "Checking installation"
( if [[ "$(occ -V 2>&1)" == *"Composer autoloader not found"* ]]; then
touch /reinstall
fi ) &> /dev/null
@@ -76,22 +76,22 @@ fi ) &> /dev/null
# Reinstall if needed
if [ -f /reinstall ]; then
rm /reinstall
bashio::log.error "... issue with installation detected, reinstallation will proceed"
bashio::log.red "... issue with installation detected, reinstallation will proceed"
# Redownload nextcloud if wrong version
if [[ ! "$CURRENTVERSION" == "$CONTAINERVERSION" ]]; then
basio::log.fatal "... version installed is : $CURRENTVERSION and version bundled is : $CONTAINERVERSION, need to redownload files"
bashio::log.fatal "... download nextcloud version"
basio::log.red "... version installed is : $CURRENTVERSION and version bundled is : $CONTAINERVERSION, need to redownload files"
bashio::log.green "... 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 || \
(bashio::log.fatal "Your version doesn't exist... Please restore backup or fully uninstall addon" && exit 1)
fi
# Reinstall
bashio::log.warning "... reinstall ongoing, please wait"
bashio::log.green "... reinstall ongoing, please wait"
rm /data/config/www/nextcloud/index.php && \
/./etc/s6-overlay/s6-rc.d/init-nextcloud-config/run
fi
bashio::log.info "... done"
bashio::log.green "... done"