From 78db690d1034feee64fce71b1a20c049dbfc29de Mon Sep 17 00:00:00 2001 From: loxeno Date: Wed, 26 Jan 2022 21:28:04 +0100 Subject: [PATCH] feat: Allow custom script execution on installation --- 21/apache/entrypoint.sh | 4 ++++ 21/fpm-alpine/entrypoint.sh | 4 ++++ 21/fpm/entrypoint.sh | 4 ++++ 22/apache/entrypoint.sh | 4 ++++ 22/fpm-alpine/entrypoint.sh | 4 ++++ 22/fpm/entrypoint.sh | 4 ++++ 23/apache/entrypoint.sh | 4 ++++ 23/fpm-alpine/entrypoint.sh | 4 ++++ 23/fpm/entrypoint.sh | 4 ++++ README.md | 4 ++++ docker-entrypoint.sh | 4 ++++ 11 files changed, 44 insertions(+) diff --git a/21/apache/entrypoint.sh b/21/apache/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/21/apache/entrypoint.sh +++ b/21/apache/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/21/fpm-alpine/entrypoint.sh b/21/fpm-alpine/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/21/fpm-alpine/entrypoint.sh +++ b/21/fpm-alpine/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/21/fpm/entrypoint.sh b/21/fpm/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/21/fpm/entrypoint.sh +++ b/21/fpm/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/22/apache/entrypoint.sh b/22/apache/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/22/apache/entrypoint.sh +++ b/22/apache/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/22/fpm-alpine/entrypoint.sh b/22/fpm-alpine/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/22/fpm-alpine/entrypoint.sh +++ b/22/fpm-alpine/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/22/fpm/entrypoint.sh b/22/fpm/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/22/fpm/entrypoint.sh +++ b/22/fpm/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/23/apache/entrypoint.sh b/23/apache/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/23/apache/entrypoint.sh +++ b/23/apache/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/23/fpm-alpine/entrypoint.sh b/23/fpm-alpine/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/23/fpm-alpine/entrypoint.sh +++ b/23/fpm-alpine/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/23/fpm/entrypoint.sh b/23/fpm/entrypoint.sh index b6da893b..e21c9a29 100755 --- a/23/fpm/entrypoint.sh +++ b/23/fpm/entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi diff --git a/README.md b/README.md index 28edcce9..bf2d97d4 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 custom apps, or execute occ commands, you can provide the path to a script that is run in the context of the www-data user. + +- `NEXTCLOUD_CUSTOM_INSTALL_SCRIPT` (not set by default) The path to a script that is mounted as volume. + 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`) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index b6da893b..e21c9a29 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -174,6 +174,10 @@ 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_CUSTOM_INSTALL_SCRIPT+x}" ]; then + run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}" + fi else echo "running web-based installer on first connect!" fi