From 3f01fc81decc1ba933e2b4fe9c32ac28ff259ddd Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 25 Mar 2023 13:01:54 +0100 Subject: [PATCH] Improved code --- nextcloud/CHANGELOG.md | 7 +++++++ nextcloud/rootfs/etc/cont-init.d/02-init_steps.sh | 6 ++++++ nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh | 13 ++++--------- .../rootfs/etc/cont-init.d/99-elasticsearch.sh | 13 ++++--------- nextcloud/rootfs/etc/cont-init.d/99-ocr.sh | 13 ++++--------- .../rootfs/etc/cont-init.d/99-trusted_domains.sh | 13 ++++--------- 6 files changed, 29 insertions(+), 36 deletions(-) diff --git a/nextcloud/CHANGELOG.md b/nextcloud/CHANGELOG.md index aa821f75e..c34cd125b 100644 --- a/nextcloud/CHANGELOG.md +++ b/nextcloud/CHANGELOG.md @@ -1,11 +1,18 @@ +- Improve : status check code +- Fix : reinstallation code ## 26.0.0 (24-03-2023) + - Update to latest version from linuxserver/docker-nextcloud - auto_update boolean option : automatically updates the nextcloud instance with the container version + ### 25.0.5-14 (23-03-2023) + - Minor bugs fixed - Revert version number to align with container + ### 25.0.4-11 (22-03-2023) + - Minor bugs fixed - Implemented safety check that reinstalls nextcloud if issue detected https://github.com/alexbelgium/hassio-addons/issues/764 - Implemented healthcheck diff --git a/nextcloud/rootfs/etc/cont-init.d/02-init_steps.sh b/nextcloud/rootfs/etc/cont-init.d/02-init_steps.sh index b54c25a15..33d514494 100755 --- a/nextcloud/rootfs/etc/cont-init.d/02-init_steps.sh +++ b/nextcloud/rootfs/etc/cont-init.d/02-init_steps.sh @@ -28,6 +28,11 @@ done # CHECK STATUS # ################ +# Clean remnant files +if [ -f /notinstalled ]; then + rm /notinstalled +fi + # Get launcher LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" if [ ! -f /data/config/www/nextcloud/occ ]; then @@ -47,6 +52,7 @@ if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]] || [ ! -f /data/config/www/ne 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 " " + touch /notinstalled exit 0 elif [[ $($LAUNCHER -V 2>&1) == *"Nextcloud"* ]]; then # Log diff --git a/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh b/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh index 8362b3d59..88d04802e 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh @@ -1,16 +1,11 @@ #!/usr/bin/with-contenv bashio # shellcheck shell=bash -LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" -if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then - LAUNCHER=$(find / -name "occ" -print -quit) -fi || bashio::log.info "occ not found" +# Only execute if installed +if [ -f /notinstalled ]; then exit 0; fi -# Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then - echo "... please install first Nextcloud through the webui" - exit 0 -fi +# Specify launcher +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" # Install specific packages if [ ! -d /data/config/www/nextcloud/apps/pdfannotate ]; then diff --git a/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh b/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh index ba1a78d77..aee460460 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh @@ -2,16 +2,11 @@ # shellcheck shell=bash # shellcheck disable=SC2086 -LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" -if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then - LAUNCHER=$(find / -name "occ" -print -quit) -fi || bashio::log.info "occ not found" +# Only execute if installed +if [ -f /notinstalled ]; then exit 0; fi -# Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then - echo "... please install first Nextcloud through the webui" - exit 0 -fi +# Specify launcher +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" if $LAUNCHER fulltextsearch:test &>/dev/null; then echo "Full Text Search is already working" diff --git a/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh b/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh index 827de3fd0..7609c7c2a 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh @@ -1,16 +1,11 @@ #!/usr/bin/with-contenv bashio # shellcheck shell=bash -LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" -if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then - LAUNCHER=$(find / -name "occ" -print -quit) -fi || bashio::log.info "occ not found" +# Only execute if installed +if [ -f /notinstalled ]; then exit 0; fi -# Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then - echo "... please install first Nextcloud through the webui" - exit 0 -fi +# Specify launcher +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" # Install OCR if requested if [ "$(bashio::config 'OCR')" = "true" ]; then diff --git a/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh index f0f1f1644..fa507da54 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh @@ -1,16 +1,11 @@ #!/usr/bin/with-contenv bashio # shellcheck shell=bash -LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" -if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then - LAUNCHER=$(find / -name "occ" -print -quit) -fi || bashio::log.info "occ not found" +# Only execute if installed +if [ -f /notinstalled ]; then exit 0; fi -# Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then - echo "... please install first Nextcloud through the webui" - exit 0 -fi +# Specify launcher +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" #################### # Initialization #