diff --git a/root/defaults/config.php b/root/defaults/config.php index 7a17b70..db32f41 100644 --- a/root/defaults/config.php +++ b/root/defaults/config.php @@ -1,6 +1,18 @@ '\OC\Memcache\APCu', +$CONFIG = [ + 'memcache.local' => '\\OC\\Memcache\\APCu', + 'memcache.distributed' => '\\OC\\Memcache\\Memcached', 'datadirectory' => '/data', - ); - + 'apps_paths' => [ + 0 => [ + 'path' => '/app/www/public/apps', + 'url' => '/apps', + 'writable' => false, + ], + 1 => [ + 'path' => '/app/www/public/custom_apps', + 'url' => '/custom_apps', + 'writable' => true, + ], + ], +]; diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index a670a35..d478afc 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -35,9 +35,21 @@ for dir in config custom_apps themes; do fi done -# copy defaults +# setup config cp -n /defaults/config.php /app/www/public/config/config.php 2> >(grep -v 'cp: not replacing') -datadirectory=$(php -r "require '/app/www/public/config/config.php'; echo \$CONFIG['datadirectory'];" 2>/dev/null) +if ! occ config:system:get memcache.local; then + occ config:system:set memcache.local --value='\\OC\\Memcache\\APCu' +fi +if ! occ config:system:get memcache.distributed; then + occ config:system:set memcache.distributed --value='\\OC\\Memcache\\Memcached' +fi +if ! occ config:system:get datadirectory; then + occ config:system:set datadirectory --value='/data' +fi +if ! occ config:system:get apps_paths || ! occ config:system:get apps_paths | grep -q 'path: /app/www/public/apps' || ! occ config:system:get apps_paths | grep -q 'path: /app/www/public/custom_apps'; then + occ config:import < <(echo '{"system":{"apps_paths":[{"path":"\/app\/www\/public\/apps","url":"\/apps","writable":false},{"path":"\/app\/www\/public\/custom_apps","url":"\/custom_apps","writable":true}]}}') +fi +datadirectory=$(occ config:system:get datadirectory) # symlink data folder if [ "$(readlink /app/www/public/data)" != "${datadirectory}" ]; then