mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-12 02:41:02 +01:00
clean
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
$CONFIG = array (
|
||||
'memcache.local' => '\OC\Memcache\APCu',
|
||||
'datadirectory' => '/share/nextcloud',
|
||||
);
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
upstream php-handler {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name _;
|
||||
ssl_certificate /ssl/nextcloud/keys/cert.crt;
|
||||
ssl_certificate_key /ssl/nextcloud/keys/cert.key;
|
||||
|
||||
# Add headers to serve security related headers
|
||||
# Before enabling Strict-Transport-Security headers please read into this
|
||||
# topic first.
|
||||
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
|
||||
#
|
||||
# WARNING: Only add the preload option once you read about
|
||||
# the consequences in https://hstspreload.org/. This option
|
||||
# will add the domain to a hardcoded list that is shipped
|
||||
# in all major browsers and getting removed from this list
|
||||
# could take several months.
|
||||
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Referrer-Policy no-referrer;
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
root /data/config/www/nextcloud/;
|
||||
# display real ip in nginx logs when connected through reverse proxy via docker network
|
||||
set_real_ip_from 172.0.0.0/8;
|
||||
real_ip_header X-Forwarded-For;
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
location = /.well-known/carddav {
|
||||
return 301 $scheme://$host:$server_port/remote.php/dav;
|
||||
}
|
||||
location = /.well-known/caldav {
|
||||
return 301 $scheme://$host:$server_port/remote.php/dav;
|
||||
}
|
||||
location = /.well-known/webfinger {
|
||||
return 301 $scheme://$host:$server_port/public.php?service=webfinger;
|
||||
}
|
||||
location = /.well-known/host-meta {
|
||||
return 301 $scheme://$host:$server_port/public.php?service=host-meta;
|
||||
}
|
||||
location = /.well-known/host-meta.json {
|
||||
return 301 $scheme://$host:$server_port/public.php?service=host-meta-json;
|
||||
}
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||
location / {
|
||||
rewrite ^ /index.php;
|
||||
}
|
||||
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
|
||||
deny all;
|
||||
}
|
||||
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
|
||||
deny all;
|
||||
}
|
||||
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
|
||||
set $path_info $fastcgi_path_info;
|
||||
try_files $fastcgi_script_name =404;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
fastcgi_param HTTPS on;
|
||||
fastcgi_param modHeadersAvailable true;
|
||||
fastcgi_param front_controller_active true;
|
||||
fastcgi_pass php-handler;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_request_buffering off;
|
||||
}
|
||||
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
|
||||
try_files $uri/ =404;
|
||||
index index.php;
|
||||
}
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
# Add headers to serve security related headers
|
||||
# Before enabling Strict-Transport-Security headers please read into this
|
||||
# topic first.
|
||||
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
|
||||
#
|
||||
# WARNING: Only add the preload option once you read about
|
||||
# the consequences in https://hstspreload.org/. This option
|
||||
# will add the domain to a hardcoded list that is shipped
|
||||
# in all major browsers and getting removed from this list
|
||||
# could take several months.
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Referrer-Policy no-referrer;
|
||||
access_log off;
|
||||
}
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
ocpath="${NEXTCLOUD_PATH}"
|
||||
htuser='abc'
|
||||
htgroup='abc'
|
||||
rootuser='root'
|
||||
|
||||
printf "Creating possible missing Directories\n"
|
||||
mkdir -p $ocpath/data
|
||||
mkdir -p $ocpath/assets
|
||||
mkdir -p $ocpath/updater
|
||||
mkdir -p $ocpath/apps
|
||||
mkdir -p $ocpath/assets
|
||||
mkdir -p $ocpath/config
|
||||
mkdir -p $ocpath/data
|
||||
mkdir -p $ocpath/themes
|
||||
mkdir -p /data/config/nextcloud/config
|
||||
mkdir -p /data/config/nextcloud/data
|
||||
mkdir -p /data/config/www/nextcloud/occ 2>/dev/null
|
||||
mkdir -p /share/nextcloud
|
||||
mkdir -p /ssl/nextcloud/keys
|
||||
|
||||
printf "chmod Files and Directories. This could take some time, please wait...\n"
|
||||
#chmod -R 777 ${ocpath}
|
||||
find ${ocpath}/ -type f -exec chmod 0640 {} \;
|
||||
find ${ocpath}/ -type d -exec chmod 0750 {} \;
|
||||
|
||||
#find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
|
||||
#find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
|
||||
|
||||
printf "chown Directories. This could take some time, please wait...\n"
|
||||
chown -R ${rootuser}:${htgroup} ${ocpath}/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/assets/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/config/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/data/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
|
||||
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
|
||||
chown -R ${htuser}:${htgroup} /share/nextcloud
|
||||
chown -R ${htuser}:${htgroup} /ssl/nextcloud/keys || true
|
||||
|
||||
chmod +x ${ocpath}/occ
|
||||
|
||||
printf "chmod/chown .htaccess\n"
|
||||
if [ -f ${ocpath}/.htaccess ]
|
||||
then
|
||||
chmod 0644 ${ocpath}/.htaccess
|
||||
chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
|
||||
fi
|
||||
if [ -f ${ocpath}/data/.htaccess ]
|
||||
then
|
||||
chmod 0644 ${ocpath}/data/.htaccess
|
||||
chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
|
||||
fi
|
||||
@@ -1,102 +0,0 @@
|
||||
## Version 2018/08/16 - Changelog: https://github.com/linuxserver/docker-baseimage-alpine-nginx/commits/master/root/defaults/nginx.conf
|
||||
|
||||
user abc;
|
||||
worker_processes 4;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 300;
|
||||
types_hash_max_size 2048;
|
||||
fastcgi_read_timeout 86400;
|
||||
# server_tokens off;
|
||||
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
|
||||
client_max_body_size 0;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /data/config/log/nginx/access.log;
|
||||
error_log /data/config/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
# gzip_vary on;
|
||||
# gzip_proxied any;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_buffers 16 8k;
|
||||
# gzip_http_version 1.1;
|
||||
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
##
|
||||
# nginx-naxsi config
|
||||
##
|
||||
# Uncomment it if you installed nginx-naxsi
|
||||
##
|
||||
|
||||
#include /etc/nginx/naxsi_core.rules;
|
||||
|
||||
##
|
||||
# nginx-passenger config
|
||||
##
|
||||
# Uncomment it if you installed nginx-passenger
|
||||
##
|
||||
|
||||
#passenger_root /usr;
|
||||
#passenger_ruby /usr/bin/ruby;
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /data/config/nginx/site-confs/*;
|
||||
|
||||
}
|
||||
|
||||
#mail {
|
||||
# # See sample authentication script at:
|
||||
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
||||
#
|
||||
# # auth_http localhost/auth.php;
|
||||
# # pop3_capabilities "TOP" "USER";
|
||||
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
||||
#
|
||||
# server {
|
||||
# listen localhost:110;
|
||||
# protocol pop3;
|
||||
# proxy on;
|
||||
# }
|
||||
#
|
||||
# server {
|
||||
# listen localhost:143;
|
||||
# protocol imap;
|
||||
# proxy on;
|
||||
# }
|
||||
#}
|
||||
daemon off;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
0 * * * * run-parts /etc/periodic/hourly
|
||||
0 2 * * * run-parts /etc/periodic/daily
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
# nextcloud cron
|
||||
*/5 * * * * s6-setuidgid abc php7 -f /data/config/www/nextcloud/cron.php
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
# If dockerfile failed install manually
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
echo "Executing script"
|
||||
PACKAGES=$(< /ENVFILE)
|
||||
(
|
||||
#######################
|
||||
# Automatic installer #
|
||||
#######################
|
||||
$(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \
|
||||
$(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \
|
||||
curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \
|
||||
chmod 777 /automatic_packages.sh && \
|
||||
eval /./automatic_packages.sh "$PACKAGES" && \
|
||||
rm /automatic_packages.sh
|
||||
|
||||
) >/dev/null
|
||||
|
||||
fi
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Displays a simple add-on banner on startup
|
||||
# ==============================================================================
|
||||
|
||||
if bashio::supervisor.ping; then
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||
bashio::log.blue " $(bashio::addon.description)"
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
|
||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||
bashio::log.magenta ' There is an update available for this add-on!'
|
||||
bashio::log.magenta \
|
||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||
else
|
||||
bashio::log.green ' You are running the latest version of this add-on.'
|
||||
fi
|
||||
|
||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue \
|
||||
' Please, share the above information when looking for help'
|
||||
bashio::log.blue \
|
||||
' or support in, e.g., GitHub, forums'
|
||||
bashio::log.green \
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
PUID=$(bashio::config "PUID")
|
||||
PGID=$(bashio::config "PGID")
|
||||
|
||||
groupmod -o -g "$PGID" abc
|
||||
usermod -o -u "$PUID" abc
|
||||
mkdir -p /data/config
|
||||
mkdir -p /share/nextcloud
|
||||
echo '
|
||||
-------------------------------------
|
||||
_ ()
|
||||
| | ___ _ __
|
||||
| | / __| | | / \
|
||||
| | \__ \ | | | () |
|
||||
|_| |___/ |_| \__/
|
||||
|
||||
|
||||
Brought to you by linuxserver.io
|
||||
-------------------------------------'
|
||||
if [[ -f /donate.txt ]]; then
|
||||
echo '
|
||||
To support the app dev(s) visit:'
|
||||
cat /donate.txt
|
||||
fi
|
||||
echo '
|
||||
To support LSIO projects visit:
|
||||
https://www.linuxserver.io/donate/
|
||||
-------------------------------------
|
||||
GID/UID
|
||||
-------------------------------------'
|
||||
echo "
|
||||
User uid: $(id -u abc)
|
||||
User gid: $(id -g abc)
|
||||
-------------------------------------
|
||||
"
|
||||
chown abc:abc /app
|
||||
chown abc:abc /data/config
|
||||
chown abc:abc /defaults
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
if bashio::config.true 'use_own_certs'; then
|
||||
|
||||
bashio::log.info "Using referenced ssl certificates..."
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
|
||||
#Check if files exist
|
||||
echo "... checking if referenced files exist"
|
||||
[ ! -f /ssl/$CERTFILE ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$CERTFILE not found" && bashio::exit.nok
|
||||
[ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$KEYFILE not found" && bashio::exit.nok
|
||||
|
||||
else
|
||||
mkdir -p /ssl/nextcloud/keys
|
||||
bashio::log.info "No ssl certificates set. Auto generating ones..."
|
||||
SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*"
|
||||
openssl req -new -x509 -days 3650 -nodes -out /ssl/nextcloud/keys/cert.crt -keyout /ssl/nextcloud/keys/cert.key -subj "$SUBJECT"
|
||||
CERTFILE="nextcloud/keys/cert.crt"
|
||||
KEYFILE="nextcloud/keys/cert.key"
|
||||
|
||||
fi
|
||||
|
||||
#Sets certificates
|
||||
echo "... adding ssl certs in files"
|
||||
#Sets certificates
|
||||
for NGINXFILE in "/defaults/default" "/config/nginx/site-confs/default" "/data/config/nginx/site-confs/default"; do
|
||||
if [ -f $NGINXFILE ]; then
|
||||
LINE=$(sed -n "/ssl_certificate /=" $NGINXFILE)
|
||||
if [ ! -z $LINE ]; then
|
||||
sed -i "/ssl_certificate/ d" $NGINXFILE
|
||||
sed -i "$LINE a ssl_certificate_key /ssl/$KEYFILE;" $NGINXFILE
|
||||
sed -i "$LINE a ssl_certificate /ssl/$CERTFILE;" $NGINXFILE
|
||||
fi
|
||||
fi
|
||||
done
|
||||
bashio::log.info "... done"
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
#create folders
|
||||
mkdir -p \
|
||||
/share/nextcloud \
|
||||
/data/config/nextcloud/config \
|
||||
/data/config/nextcloud/data
|
||||
|
||||
#permissions
|
||||
chown abc:abc \
|
||||
/share/nextcloud \
|
||||
/data/config/nextcloud/config \
|
||||
/data/config/nextcloud/data
|
||||
|
||||
chown -R abc:abc \
|
||||
/var/lib/nginx
|
||||
|
||||
rm -r /data/config/www/nextcloud/assets &>/dev/null
|
||||
chmod -R 777 /data/config
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# create folders
|
||||
mkdir -p \
|
||||
"${NEXTCLOUD_PATH}" \
|
||||
/data/config/crontabs
|
||||
|
||||
# install app
|
||||
if [ ! -e "${NEXTCLOUD_PATH}/index.php" ]; then
|
||||
tar xf /app/nextcloud.tar.bz2 -C \
|
||||
"${NEXTCLOUD_PATH}" --strip-components=1
|
||||
chown abc:abc -R \
|
||||
"${NEXTCLOUD_PATH}"
|
||||
chmod +x "${NEXTCLOUD_PATH}/occ"
|
||||
fi
|
||||
|
||||
#?set cronjob
|
||||
[[ ! -f /data/config/crontabs/root ]] && \
|
||||
cp /defaults/root /data/config/crontabs/root
|
||||
cp /data/config/crontabs/root /etc/crontabs/root
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# copy config
|
||||
[[ ! -f /data/config/www/nextcloud/config/config.php ]] && \
|
||||
cp /defaults/config.php /data/config/www/nextcloud/config/config.php
|
||||
|
||||
# permissions
|
||||
chown abc:abc \
|
||||
/data/config/www/nextcloud/config/config.php
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/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"
|
||||
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) == *"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
|
||||
|
||||
############
|
||||
# BASED ON #
|
||||
#################################################################################
|
||||
# https://raw.githubusercontent.com/nextcloud/vm/master/apps/fulltextsearch.sh #
|
||||
# T&M Hansson IT AB © - 2021, https://www.hanssonit.se/ #
|
||||
# SwITNet Ltd © - 2021, https://switnet.net/ #
|
||||
#################################################################################
|
||||
|
||||
if bashio::config.true 'Full_Text_Search'; then
|
||||
if [ $LAUNCHER fulltextsearch:index ] &>/dev/null; then
|
||||
echo "Full Text Search is already working"
|
||||
break 2
|
||||
fi
|
||||
|
||||
echo "Installing Full Text Search"
|
||||
# Reset Full Text Search to be able to index again, and also remove the app to be able to install it again
|
||||
occ fulltextsearch:reset &>/dev/null || true
|
||||
APPS=(fulltextsearch fulltextsearch_elasticsearch files_fulltextsearch)
|
||||
for app in "${APPS[@]}"; do
|
||||
# If app exists, remove it
|
||||
[ ! -z $($LAUNCHER app:getpath $app) ] && $LAUNCHER app:remove $app &>/dev/null
|
||||
done
|
||||
|
||||
# Get Full Text Search app for nextcloud
|
||||
for app in "${APPS[@]}"; do
|
||||
echo "... installing apps : $app"
|
||||
$LAUNCHER app:install $app >/dev/null
|
||||
$LAUNCHER app:enable $app >/dev/null
|
||||
done
|
||||
chown -R abc:abc $NEXTCLOUD_PATH/apps
|
||||
|
||||
if bashio::config.has_value 'elasticsearch_server'; then
|
||||
HOST=$(bashio::config 'elasticsearch_server')
|
||||
else
|
||||
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="${HOST%/*}:9200"
|
||||
fi
|
||||
|
||||
# Final setup
|
||||
echo "... settings apps"
|
||||
#occ fulltextsearch:configure '{"search_platform":"ElasticSearchPlatform"}'
|
||||
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://$HOST:9200\"}" &>/dev/null
|
||||
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_index\":\"my_index\"}" &>/dev/null
|
||||
$LAUNCHER fulltextsearch_elasticsearch:configure "{\"analyzer_tokenizer\":\"standard\"}" &>/dev/null
|
||||
$LAUNCHER fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}' &>/dev/null || true
|
||||
$LAUNCHER files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" &>/dev/null || true
|
||||
|
||||
# Is server detected
|
||||
# if [ curl $HOST ] &>/dev/null; then
|
||||
# Wait further for cache for index to work
|
||||
echo "Waiting for a few seconds before indexing starts..."
|
||||
sleep 10s
|
||||
if $LAUNCHER fulltextsearch:index &>/dev/null; then
|
||||
bashio::log.info "Full Text Search was successfully installed using elasticsearch server $HOST!"
|
||||
|
||||
else
|
||||
|
||||
bashio::log.warning "Elasticsearch can't connect. Please manually define its server in the options"
|
||||
fi
|
||||
else
|
||||
echo "Full_Text_Search option not set"
|
||||
fi
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/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"
|
||||
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) == *"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 OCR if requested
|
||||
if bashio::config.has_value 'OCR'; then
|
||||
# Install package
|
||||
if $(bashio::config 'OCR') = true; then
|
||||
|
||||
# Get Full Text Search app for nextcloud
|
||||
echo "... installing apps : fulltextsearch"
|
||||
occ app:install files_fulltextsearch_tesseract &>/dev/null || true
|
||||
occ app:enable files_fulltextsearch_tesseract &>/dev/null || true
|
||||
|
||||
echo "Installing OCR"
|
||||
apk add --quiet --no-cache tesseract-ocr || apk add --quiet --no-cache tesseract-ocr@community
|
||||
# Install additional language if requested
|
||||
if bashio::config.has_value 'OCRLANG'; then
|
||||
LANG=$(bashio::config 'OCRLANG')
|
||||
apk add --quiet --no-cache tesseract-ocr-data-$LANG || apk add --quiet --no-cache tesseract-ocr-data-$LANG@community && \
|
||||
bashio::log.info "OCR Language installed : $LANG" || bashio::log.fatal "Couldn't install OCR lang $LANG. Please check its format is conform"
|
||||
|
||||
# Downloading trainer data
|
||||
cd /usr/share/tessdata
|
||||
sudo rm -r $LANG.traineddata &>/dev/null || true
|
||||
wget https://github.com/tesseract-ocr/tessdata/raw/main/$LANG.traineddata &>/dev/null
|
||||
|
||||
fi
|
||||
elif $(bashio::config 'OCR') = false; then
|
||||
bashio::log.info 'Removing OCR'
|
||||
# Delete package
|
||||
apk del tesseract-ocr.* &>/dev/null || true
|
||||
# Remove app
|
||||
occ app:disable files_fulltextsearch_tesseract &>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/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"
|
||||
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) == *"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
|
||||
|
||||
####################
|
||||
# Initialization #
|
||||
####################
|
||||
|
||||
if bashio::config.has_value 'trusted_domains'; then
|
||||
|
||||
bashio::log.info "Currently set trusted domains :"
|
||||
$LAUNCHER config:system:get trusted_domains || bashio::log.info "No trusted domain set yet. The first one will be set when doing initial configuration"
|
||||
|
||||
bashio::log.info "Trusted domains set in the configuration. Refreshing domains." && \
|
||||
###################################
|
||||
# Remove previous trusted domains #
|
||||
###################################
|
||||
bashio::log.info "... removing previously added trusted domain (except for first one created)"
|
||||
i=2
|
||||
until [ $i -gt 5 ]; do
|
||||
$LAUNCHER config:system:delete trusted_domains $i && \
|
||||
((i = i + 1)) || exit
|
||||
done
|
||||
|
||||
###########################
|
||||
# Add new trusted domains #
|
||||
###########################
|
||||
TRUSTEDDOMAINS=$(bashio::config 'trusted_domains')
|
||||
bashio::log.info "... alignement with trusted domains list : ${TRUSTEDDOMAINS}"
|
||||
for domain in ${TRUSTEDDOMAINS//,/ }; do # Comma separated values
|
||||
bashio::log.info "... adding ${domain}"
|
||||
$LAUNCHER config:system:set trusted_domains $i --value=${domain}
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
bashio::log.info "Remaining configurated trusted domains :"
|
||||
bashio::log.info "$($LAUNCHER config:system:get trusted_domains)" || exit
|
||||
|
||||
fi
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
/usr/sbin/crond -f -S -l 0 -c /etc/crontabs
|
||||
Reference in New Issue
Block a user