Check installation

This commit is contained in:
Alexandre
2021-11-09 12:24:37 +01:00
parent d8d492c16d
commit 95b5e06434
3 changed files with 34 additions and 34 deletions

View File

@@ -1,12 +1,12 @@
#!/usr/bin/with-contenv bashio #!/usr/bin/with-contenv bashio
LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" 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 if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then
LAUNCHER=$(find / -name "occ" -print -quit) LAUNCHER=$(find / -name "occ" -print -quit)
fi || bashio::log.info "occ not found" fi || bashio::log.info "occ not found"
# Make sure there is an Nextcloud installation # Make sure there is an Nextcloud installation
if ! [ "$($LAUNCHER -V)" ]; then if [[ $($LAUNCHER -V) == *"not installed"* ]]; then
bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user."
exit 0 exit 0
fi fi
@@ -20,7 +20,7 @@ fi
################################################################################# #################################################################################
if bashio::config.true 'Full_Text_Search'; then if bashio::config.true 'Full_Text_Search'; then
if [ $LAUNCHER fulltextsearch:index &>/dev/null ] ; then if [ $LAUNCHER fulltextsearch:index ] &>/dev/null; then
echo "Full Text Search is already working" echo "Full Text Search is already working"
break 2 break 2
fi fi
@@ -42,13 +42,13 @@ if bashio::config.true 'Full_Text_Search'; then
done done
chown -R abc:abc $NEXTCLOUD_PATH/apps chown -R abc:abc $NEXTCLOUD_PATH/apps
if bashio::config.has_value 'elasticsearch_server'; then if bashio::config.has_value 'elasticsearch_server'; then
HOST=$(bashio::config 'elasticsearch_server') HOST=$(bashio::config 'elasticsearch_server')
else else
bashio::log.warning 'Please define elasticsearch server url in addon options with the format "ip:port" such as "192.168.178.1:9200"' bashio::log.warning 'Please define elasticsearch server url in addon options with the format "ip:port" such as "192.168.178.1:9200"'
HOST=$(bashio::network.ipv4_address) HOST=$(bashio::network.ipv4_address)
HOST="${HOST%/*}:9200" HOST="${HOST%/*}:9200"
fi fi
# Final setup # Final setup
echo "... settings apps" echo "... settings apps"
@@ -60,17 +60,17 @@ fi
$LAUNCHER files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" &>/dev/null || true $LAUNCHER files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" &>/dev/null || true
# Is server detected # Is server detected
# if [ curl $HOST ] &>/dev/null; then # if [ curl $HOST ] &>/dev/null; then
# Wait further for cache for index to work # Wait further for cache for index to work
echo "Waiting for a few seconds before indexing starts..." echo "Waiting for a few seconds before indexing starts..."
sleep 10s sleep 10s
if $LAUNCHER fulltextsearch:index &>/dev/null; then if $LAUNCHER fulltextsearch:index &>/dev/null; then
bashio::log.info "Full Text Search was successfully installed using elasticsearch server $HOST!" bashio::log.info "Full Text Search was successfully installed using elasticsearch server $HOST!"
else
else bashio::log.warning "Elasticsearch can't connect. Please manually define its server in the options"
bashio::log.warning "Elasticsearch can't connect. Please manually define its server in the options" fi
fi
else else
echo "Full_Text_Search option not set" echo "Full_Text_Search option not set"
fi fi

View File

@@ -1,12 +1,12 @@
#!/usr/bin/with-contenv bashio #!/usr/bin/with-contenv bashio
LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" 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 if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then
LAUNCHER=$(find / -name "occ" -print -quit) LAUNCHER=$(find / -name "occ" -print -quit)
fi || bashio::log.info "occ not found" fi || bashio::log.info "occ not found"
# Make sure there is an Nextcloud installation # Make sure there is an Nextcloud installation
if ! [ "$($LAUNCHER -V)" ]; then if [[ $($LAUNCHER -V) == *"not installed"* ]]; then
bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user."
exit 0 exit 0
fi fi

View File

@@ -1,12 +1,12 @@
#!/usr/bin/with-contenv bashio #!/usr/bin/with-contenv bashio
LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" 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 if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then
LAUNCHER=$(find / -name "occ" -print -quit) LAUNCHER=$(find / -name "occ" -print -quit)
fi || bashio::log.info "occ not found" fi || bashio::log.info "occ not found"
# Make sure there is an Nextcloud installation # Make sure there is an Nextcloud installation
if ! [ "$($LAUNCHER -V)" ]; then if [[ $($LAUNCHER -V) == *"not installed"* ]]; then
bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user."
exit 0 exit 0
fi fi