From 1a70554c3ce3f9b5864a3e386ccdd4e1f6b5eb4a Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Mon, 5 Oct 2020 17:51:08 +0200 Subject: [PATCH] Install apps via env var for initial setup --- 20.0/apache/entrypoint.sh | 9 +++++++++ 20.0/fpm-alpine/entrypoint.sh | 9 +++++++++ 20.0/fpm/entrypoint.sh | 9 +++++++++ README.md | 4 ++++ 4 files changed, 31 insertions(+) diff --git a/20.0/apache/entrypoint.sh b/20.0/apache/entrypoint.sh index b9ec5fc5f2..9a96f82131 100755 --- a/20.0/apache/entrypoint.sh +++ b/20.0/apache/entrypoint.sh @@ -168,6 +168,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1)) done fi + if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then + echo "Install apps…" + NC_APP_IDX=1 + for APP in $NEXTCLOUD_INSTALL_APPS ; do + APP=$(echo "$APP" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + run_as "php /var/www/html/occ app:install -n $APP" + NC_APP_IDX=$(($NC_APP_IDX+1)) + done + fi else echo "running web-based installer on first connect!" fi diff --git a/20.0/fpm-alpine/entrypoint.sh b/20.0/fpm-alpine/entrypoint.sh index b9ec5fc5f2..9a96f82131 100755 --- a/20.0/fpm-alpine/entrypoint.sh +++ b/20.0/fpm-alpine/entrypoint.sh @@ -168,6 +168,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1)) done fi + if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then + echo "Install apps…" + NC_APP_IDX=1 + for APP in $NEXTCLOUD_INSTALL_APPS ; do + APP=$(echo "$APP" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + run_as "php /var/www/html/occ app:install -n $APP" + NC_APP_IDX=$(($NC_APP_IDX+1)) + done + fi else echo "running web-based installer on first connect!" fi diff --git a/20.0/fpm/entrypoint.sh b/20.0/fpm/entrypoint.sh index b9ec5fc5f2..9a96f82131 100755 --- a/20.0/fpm/entrypoint.sh +++ b/20.0/fpm/entrypoint.sh @@ -168,6 +168,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1)) done fi + if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then + echo "Install apps…" + NC_APP_IDX=1 + for APP in $NEXTCLOUD_INSTALL_APPS ; do + APP=$(echo "$APP" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + run_as "php /var/www/html/occ app:install -n $APP" + NC_APP_IDX=$(($NC_APP_IDX+1)) + done + fi else echo "running web-based installer on first connect!" fi diff --git a/README.md b/README.md index bce42c73aa..1ba18c0e87 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,10 @@ One or more trusted domains can be set through environment variable, too. They w - `NEXTCLOUD_TRUSTED_DOMAINS` (not set by default) Optional space-separated list of domains +To install apps with the initial nextcloud installation, you can set a space separated list of apps. + +- `NEXTCLOUD_INSTALL_APPS` (not set by default) Optional space-separated list of apps + The install and update script is only triggered when a default command is used (`apache-foreground` or `php-fpm`). If you use a custom command you have to enable the install / update with - `NEXTCLOUD_UPDATE` (default: _0_)