mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 05:44:03 +02:00
Update 02-init_steps.sh
This commit is contained in:
@@ -32,16 +32,16 @@ done
|
|||||||
CONTAINERVERSION="$(cat /nextcloudversion)"
|
CONTAINERVERSION="$(cat /nextcloudversion)"
|
||||||
if [ -f /data/config/www/nextcloud/version.php ]; then
|
if [ -f /data/config/www/nextcloud/version.php ]; then
|
||||||
CURRENTVERSION="$(sed -n "s|.*\OC_VersionString = '*\(.*[^ ]\) *';.*|\1|p" /data/config/www/nextcloud/version.php)"
|
CURRENTVERSION="$(sed -n "s|.*\OC_VersionString = '*\(.*[^ ]\) *';.*|\1|p" /data/config/www/nextcloud/version.php)"
|
||||||
bashio::log.info "--------------------------------------"
|
bashio::log.green "--------------------------------------"
|
||||||
bashio::log.info "Nextcloud $CURRENTVERSION is installed"
|
bashio::log.green "Nextcloud $CURRENTVERSION is installed"
|
||||||
bashio::log.info "--------------------------------------"
|
bashio::log.green "--------------------------------------"
|
||||||
else
|
else
|
||||||
if [ -d /data/config/www/nextcloud ]; then rm -r /data/config/www/nextcloud; fi
|
if [ -d /data/config/www/nextcloud ]; then rm -r /data/config/www/nextcloud; fi
|
||||||
CURRENTVERSION="$CONTAINERVERSION"
|
CURRENTVERSION="$CONTAINERVERSION"
|
||||||
bashio::log.warning "--------------------------------------------------------------------------------------------------------------"
|
bashio::log.green "--------------------------------------------------------------------------------------------------------------"
|
||||||
bashio::log.warning "Nextcloud not installed, please wait for addon startup, login Webui, install Nextcloud, then restart the addon"
|
bashio::log.yellow "Nextcloud not installed, please wait for addon startup, login Webui, install Nextcloud, then restart the addon"
|
||||||
bashio::log.warning "--------------------------------------------------------------------------------------------------------------"
|
bashio::log.green "--------------------------------------------------------------------------------------------------------------"
|
||||||
bashio::log.warning " "
|
bashio::log.green " "
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -52,14 +52,14 @@ fi
|
|||||||
# Inform if new version available
|
# Inform if new version available
|
||||||
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
|
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
|
||||||
if [ "$(version "$CONTAINERVERSION")" -gt "$(version "$CURRENTVERSION")" ]; then
|
if [ "$(version "$CONTAINERVERSION")" -gt "$(version "$CURRENTVERSION")" ]; then
|
||||||
bashio::log.warning " "
|
bashio::log.yellow " "
|
||||||
bashio::log.warning "New version available : $CONTAINERVERSION"
|
bashio::log.yellow "New version available : $CONTAINERVERSION"
|
||||||
if bashio::config.true 'auto_updater'; then
|
if bashio::config.true 'auto_updater'; then
|
||||||
if [[ $((CONTAINERVERSION-CURRENTVERSION)) = 1 ]]; then echo "nok"; fi
|
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
|
updater.phar &>/proc/1/fd/1
|
||||||
else
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ fi
|
|||||||
######################
|
######################
|
||||||
|
|
||||||
# Check if issue in installation
|
# 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
|
( if [[ "$(occ -V 2>&1)" == *"Composer autoloader not found"* ]]; then
|
||||||
touch /reinstall
|
touch /reinstall
|
||||||
fi ) &> /dev/null
|
fi ) &> /dev/null
|
||||||
@@ -76,22 +76,22 @@ fi ) &> /dev/null
|
|||||||
# Reinstall if needed
|
# Reinstall if needed
|
||||||
if [ -f /reinstall ]; then
|
if [ -f /reinstall ]; then
|
||||||
rm /reinstall
|
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
|
# Redownload nextcloud if wrong version
|
||||||
if [[ ! "$CURRENTVERSION" == "$CONTAINERVERSION" ]]; then
|
if [[ ! "$CURRENTVERSION" == "$CONTAINERVERSION" ]]; then
|
||||||
basio::log.fatal "... version installed is : $CURRENTVERSION and version bundled is : $CONTAINERVERSION, need to redownload files"
|
basio::log.red "... version installed is : $CURRENTVERSION and version bundled is : $CONTAINERVERSION, need to redownload files"
|
||||||
bashio::log.fatal "... download nextcloud version"
|
bashio::log.green "... download nextcloud version"
|
||||||
rm /app/nextcloud.tar.bz2
|
rm /app/nextcloud.tar.bz2
|
||||||
curl -o /app/nextcloud.tar.bz2 -L "https://download.nextcloud.com/server/releases/nextcloud-${CURRENTVERSION}.tar.bz2" --progress-bar || \
|
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)
|
(bashio::log.fatal "Your version doesn't exist... Please restore backup or fully uninstall addon" && exit 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reinstall
|
# Reinstall
|
||||||
bashio::log.warning "... reinstall ongoing, please wait"
|
bashio::log.green "... reinstall ongoing, please wait"
|
||||||
rm /data/config/www/nextcloud/index.php && \
|
rm /data/config/www/nextcloud/index.php && \
|
||||||
/./etc/s6-overlay/s6-rc.d/init-nextcloud-config/run
|
/./etc/s6-overlay/s6-rc.d/init-nextcloud-config/run
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.info "... done"
|
bashio::log.green "... done"
|
||||||
|
|||||||
Reference in New Issue
Block a user