From 9fa4e0e6553b1859bc43d6f9cc8fe6262646333d Mon Sep 17 00:00:00 2001 From: Alexandre Date: Wed, 22 Mar 2023 14:27:34 +0100 Subject: [PATCH] Improve occ installation detection --- nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh | 13 ++++++++++++- .../rootfs/etc/cont-init.d/99-elasticsearch.sh | 2 +- nextcloud/rootfs/etc/cont-init.d/99-ocr.sh | 2 +- .../rootfs/etc/cont-init.d/99-trusted_domains.sh | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) 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 f483f840b..912872825 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh @@ -1,10 +1,21 @@ #!/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" + +# Make sure there is an Nextcloud installation +if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then + bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." + exit 0 +fi + # Install specific packages if [ ! -d /data/config/www/nextcloud/apps/pdfannotate ]; then CURRENT="$PWD" - cd /data/config/www/nextcloud/apps &>/dev/null || exit + cd /data/config/www/nextcloud/apps || exit git clone https://gitlab.com/nextcloud-other/nextcloud-annotate pdfannotate cd "$CURRENT" || exit apk add --no-cache ghostscript >/dev/null diff --git a/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh b/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh index 31bc82dc3..6f351c359 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch.sh @@ -8,7 +8,7 @@ if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then fi || bashio::log.info "occ not found" # Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V) == *"not installed"* ]]; then +if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." exit 0 fi diff --git a/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh b/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh index f51b0f167..f5d3311e8 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-ocr.sh @@ -7,7 +7,7 @@ if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then fi || bashio::log.info "occ not found" # Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V) == *"not installed"* ]]; then +if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." exit 0 fi 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 41826993d..b49056baa 100755 --- a/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh @@ -7,7 +7,7 @@ if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then fi || bashio::log.info "occ not found" # Make sure there is an Nextcloud installation -if [[ $($LAUNCHER -V) == *"not installed"* ]]; then +if [[ $($LAUNCHER -V 2>&1) == *"not installed"* ]]; then bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." exit 0 fi