Merge pull request #133 from marciogranzotto/master

Allow changing the data directory of nextcloud
This commit is contained in:
Alexandre
2021-12-30 10:43:40 +01:00
committed by GitHub
7 changed files with 21 additions and 9 deletions

View File

@@ -37,6 +37,7 @@ PGID/PUID : 1000 #allows setting user.
trusted_domains : your-domain.com #allows to select the trusted domains. Domains not in this lis will be removed, except for the first one used in the initial configuration. trusted_domains : your-domain.com #allows to select the trusted domains. Domains not in this lis will be removed, except for the first one used in the initial configuration.
OCR : false #set to true to install tesseract-ocr capability. OCR : false #set to true to install tesseract-ocr capability.
OCRLANG : fra,eng #Any language can be set from this page (always three letters) [here](https://tesseract-ocr.github.io/tessdoc/Data-Files#data-files-for-version-400-november-29-2016). OCRLANG : fra,eng #Any language can be set from this page (always three letters) [here](https://tesseract-ocr.github.io/tessdoc/Data-Files#data-files-for-version-400-november-29-2016).
data_directory: path for the main data directory. Defaults to `/share/nextcloud`.
use_own_certs : true/false #if true, use the certfile and keyfile specified use_own_certs : true/false #if true, use the certfile and keyfile specified
certfile: fullchain.pem #ssl certificate, must be located in /ssl certfile: fullchain.pem #ssl certificate, must be located in /ssl
keyfile: privkey.pem #sslkeyfile, must be located in /ssl keyfile: privkey.pem #sslkeyfile, must be located in /ssl

View File

@@ -25,6 +25,7 @@
"use_own_certs": false, "use_own_certs": false,
"certfile": "fullchain.pem", "certfile": "fullchain.pem",
"keyfile": "privkey.pem", "keyfile": "privkey.pem",
"data_directory": "/share/nextcloud",
"trusted_domains": "your-domain, your-domain2", "trusted_domains": "your-domain, your-domain2",
"OCR": false, "OCR": false,
"OCRLANG": "fra", "OCRLANG": "fra",
@@ -38,6 +39,7 @@
"use_own_certs": "bool", "use_own_certs": "bool",
"certfile": "str", "certfile": "str",
"keyfile": "str", "keyfile": "str",
"data_directory": "str",
"OCR": "bool?", "OCR": "bool?",
"OCRLANG": "str?", "OCRLANG": "str?",
"Full_Text_Search": "bool?", "Full_Text_Search": "bool?",

View File

@@ -1,6 +1,6 @@
<?php <?php
$CONFIG = array ( $CONFIG = array (
'memcache.local' => '\OC\Memcache\APCu', 'memcache.local' => '\OC\Memcache\APCu',
'datadirectory' => '/share/nextcloud', 'datadirectory' => '%%datadirectory%%',
); );

View File

@@ -1,10 +1,12 @@
#!/bin/bash #!/usr/bin/with-contenv bashio
ocpath="${NEXTCLOUD_PATH}" ocpath="${NEXTCLOUD_PATH}"
htuser='abc' htuser='abc'
htgroup='abc' htgroup='abc'
rootuser='root' rootuser='root'
datadirectory=$(bashio::config 'data_directory')
printf "Creating possible missing Directories\n" printf "Creating possible missing Directories\n"
mkdir -p $ocpath/data mkdir -p $ocpath/data
mkdir -p $ocpath/assets mkdir -p $ocpath/assets
@@ -17,7 +19,7 @@ mkdir -p $ocpath/themes
mkdir -p /data/config/nextcloud/config mkdir -p /data/config/nextcloud/config
mkdir -p /data/config/nextcloud/data mkdir -p /data/config/nextcloud/data
mkdir -p /data/config/www/nextcloud/occ 2>/dev/null mkdir -p /data/config/www/nextcloud/occ 2>/dev/null
mkdir -p /share/nextcloud mkdir -p $datadirectory
mkdir -p /ssl/nextcloud/keys mkdir -p /ssl/nextcloud/keys
printf "chmod Files and Directories. This could take some time, please wait...\n" printf "chmod Files and Directories. This could take some time, please wait...\n"
@@ -36,7 +38,7 @@ chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${ocpath}/data/ chown -R ${htuser}:${htgroup} ${ocpath}/data/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/ chown -R ${htuser}:${htgroup} ${ocpath}/themes/
chown -R ${htuser}:${htgroup} ${ocpath}/updater/ chown -R ${htuser}:${htgroup} ${ocpath}/updater/
chown -R ${htuser}:${htgroup} /share/nextcloud chown -R ${htuser}:${htgroup} ${datadirectory}
chown -R ${htuser}:${htgroup} /ssl/nextcloud/keys || true chown -R ${htuser}:${htgroup} /ssl/nextcloud/keys || true
chmod +x ${ocpath}/occ chmod +x ${ocpath}/occ

View File

@@ -2,11 +2,12 @@
PUID=$(bashio::config "PUID") PUID=$(bashio::config "PUID")
PGID=$(bashio::config "PGID") PGID=$(bashio::config "PGID")
datadirectory=$(bashio::config 'data_directory')
groupmod -o -g "$PGID" abc groupmod -o -g "$PGID" abc
usermod -o -u "$PUID" abc usermod -o -u "$PUID" abc
mkdir -p /data/config mkdir -p /data/config
mkdir -p /share/nextcloud mkdir -p $datadirectory
echo ' echo '
------------------------------------- -------------------------------------
_ () _ ()

View File

@@ -1,14 +1,15 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bashio
#create folders #create folders
datadirectory=$(bashio::config 'data_directory')
mkdir -p \ mkdir -p \
/share/nextcloud \ $datadirectory \
/data/config/nextcloud/config \ /data/config/nextcloud/config \
/data/config/nextcloud/data /data/config/nextcloud/data
#permissions #permissions
chown abc:abc \ chown abc:abc \
/share/nextcloud \ $datadirectory \
/data/config/nextcloud/config \ /data/config/nextcloud/config \
/data/config/nextcloud/data /data/config/nextcloud/data

View File

@@ -1,4 +1,9 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bashio
# Change data directory
datadirectory=$(bashio::config 'data_directory')
bashio::log.info "Setting data diretory: ${datadirectory}"
sed -i "s|%%datadirectory%%|$datadirectory|g" /defaults/config.php
# copy config # copy config
[[ ! -f /data/config/www/nextcloud/config/config.php ]] && \ [[ ! -f /data/config/www/nextcloud/config/config.php ]] && \