From 23f22abb29ed5acec502ba7382ad6686a0cf9636 Mon Sep 17 00:00:00 2001 From: Evilham Date: Mon, 27 Feb 2023 19:38:41 +0100 Subject: [PATCH] cherry-pick 7196db9c conflicts solved --- dd-apps/docker/nextcloud/Dockerfile | 6 +-- dd-apps/docker/nextcloud/dd-patch | 5 +- dd-apps/docker/nextcloud/nc-setup.sh | 65 ++++++++++++-------------- dd-apps/docker/nextcloud/nextcloud.yml | 2 +- dd.conf.sample | 2 +- 5 files changed, 35 insertions(+), 45 deletions(-) diff --git a/dd-apps/docker/nextcloud/Dockerfile b/dd-apps/docker/nextcloud/Dockerfile index dfdea19..6ade834 100644 --- a/dd-apps/docker/nextcloud/Dockerfile +++ b/dd-apps/docker/nextcloud/Dockerfile @@ -82,11 +82,9 @@ COPY saml.sh / COPY template.docx / ## Save current forms plugin hash -#RUN sh -c 'curl -sL https://api.github.com/repos/3iPunt/nextcloud_forms/commits/STABLE_25 | jq -r .sha > /forms.hash' +RUN sh -c 'curl -sL https://api.github.com/repos/3iPunt/nextcloud_forms/commits/STABLE_25 | jq -r .sha > /forms.hash' ## And current forms code -#RUN sh -c 'curl -sL "https://github.com/3iPunt/nextcloud_forms/archive/$(cat /forms.hash).zip" > /forms.zip' -# Mail app patches. To remove in NC 25 -COPY nc_mail/ /nc_mail/ +RUN sh -c 'curl -sL "https://github.com/3iPunt/nextcloud_forms/archive/$(cat /forms.hash).zip" > /forms.zip' # Setup cron as documented in: # https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/cron/fpm-alpine/Dockerfile diff --git a/dd-apps/docker/nextcloud/dd-patch b/dd-apps/docker/nextcloud/dd-patch index 72f2848..b0018a7 100644 --- a/dd-apps/docker/nextcloud/dd-patch +++ b/dd-apps/docker/nextcloud/dd-patch @@ -2,7 +2,4 @@ # file license author source nginx.conf AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/docker/04ab3157e4f1197a9f8f4b91cf2430586356dd9a/.examples/docker-compose/with-nginx-proxy/postgres/fpm/web/nginx.conf supervisord.conf AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/docker/04ab3157e4f1197a9f8f4b91cf2430586356dd9a/.examples/dockerfiles/cron/fpm-alpine/supervisord.conf -nc_mail/appinfo/info.xml AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/mail/v1.15.2/appinfo/info.xml -nc_mail/lib/Command/UpdateAccount.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/mail/1e777a1783254bd4b7f69f39a6c5123323f8b701/lib/Command/UpdateAccount.php -nc_mail/lib/Db/MailAccountMapper.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/mail/1e777a1783254bd4b7f69f39a6c5123323f8b701/lib/Db/MailAccountMapper.php -src/themes/dd/core/templates/layout.user.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/server/v21.0.9/core/templates/layout.user.php +src/themes/dd/core/templates/layout.user.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/server/v25.0.5/core/templates/layout.user.php diff --git a/dd-apps/docker/nextcloud/nc-setup.sh b/dd-apps/docker/nextcloud/nc-setup.sh index 86b2fe5..2c65c0a 100755 --- a/dd-apps/docker/nextcloud/nc-setup.sh +++ b/dd-apps/docker/nextcloud/nc-setup.sh @@ -20,7 +20,10 @@ plugin_status() { printf "%s\t%s" "enabled" "${version}" else version="$(echo "${plugins_state}" | jq -r ".disabled.${plugin}")" - if [ "${version}" != "null" ]; then + is_available="$(echo "${plugins_state}" | jq -r \ + --arg plugin "${plugin}" \ + '.disabled | to_entries[] | select(.key == $plugin) | .key')" + if [ "${is_available}" = "${plugin}" ]; then printf "%s\t%s" "disabled" "${version}" else printf "%s\t%s" "n/a" "n/a" @@ -58,7 +61,7 @@ occupgrade # Operators should instead rely on the environment variables to ease deployment # EXTRA_PLUGINS_ENABLE and EXTRA_PLUGINS_DISABLE CORE_PLUGINS_ENABLE="user_saml,bruteforcesettings,polls,calendar,spreed,bbb,mail,ownpad,onlyoffice" -CORE_PLUGINS_DISABLE="firstrunwizard,recommendations,dashboard,circles,forms" +CORE_PLUGINS_DISABLE="firstrunwizard,recommendations,dashboard,circles" if [ "${DISABLE_CLAMAV:-true}" = "false" ]; then CORE_PLUGINS_ENABLE="${CORE_PLUGINS_ENABLE},files_antivirus" @@ -73,7 +76,7 @@ PLUGINS="${CORE_PLUGINS_ENABLE},${CORE_PLUGINS_DISABLE},${EXTRA_PLUGINS_ENABLE:- # Install all plugins # shellcheck disable=SC2086 # We do want multiple arguments for plugin in $(echo "${PLUGINS}" | tr ',' '\n'); do - if plugin_status "${plugin}" | grep -q "n/a"; then + if plugin_status "${plugin}" | grep -qE "^n/a"; then echo "--> Installing ${plugin}" ./occ --no-warnings app:install "${plugin}" fi @@ -118,40 +121,32 @@ done occupgrade -# Temporary patch while upstream lands our changes -# See: https://github.com/nextcloud/mail/pull/6908 -for f in appinfo/info.xml lib/Command/UpdateAccount.php lib/Db/MailAccountMapper.php; do - install -m 0644 -o www-data -g www-data "/nc_mail/$f" "/var/www/html/custom_apps/mail/$f" -done - -occupgrade ## Forms -# TODO: This is broken in NC 24 due to: -# https://github.com/nextcloud/forms/pull/1149/files -## TODO: request explanations and reduce upstream diff -## This is what is being used: https://github.com/juanan3ip/form -#FORMS_EXPECTED_HASH="$(cat /forms.hash)" -#FORMS_DIR="/var/www/html/custom_apps/forms" -#FORMS_HASH="" -#if [ -f "${FORMS_DIR}.hash" ]; then -# FORMS_HASH="$(cat "${FORMS_DIR}.hash")" -#fi -#if [ "${FORMS_EXPECTED_HASH}" != "${FORMS_HASH}" ]; then -# # Remove old plugin -# rm -rf "${FORMS_DIR}" -# # Install new one -# unzip -o /forms.zip -d /tmp -# mv "/tmp/form-${FORMS_EXPECTED_HASH}" "${FORMS_DIR}" -# # Perform config / install -# npm --prefix "${FORMS_DIR}" install -# composer --ignore-platform-req=ext-dom -d"${FORMS_DIR}" install --no-dev -o -# # Place hash marker -# cp /forms.hash "${FORMS_DIR}.hash" -#fi -#if plugin_status "${plugin}" | grep -qE "^disabled"; then -# ./occ app:enable forms -#fi +## This should be upstreamed, see: +## https://github.com/juanan3ip/form/issues/76 +## This is what is being used: https://github.com/3iPunt/nextcloud_forms +FORMS_EXPECTED_HASH="$(cat /forms.hash)" +FORMS_DIR="/var/www/html/custom_apps/forms" +FORMS_HASH="" +if [ -f "${FORMS_DIR}.hash" ]; then + FORMS_HASH="$(cat "${FORMS_DIR}.hash")" +fi +if [ "${FORMS_EXPECTED_HASH}" != "${FORMS_HASH}" ]; then + # Remove old plugin + rm -rf "${FORMS_DIR}" + # Install new one + unzip -o /forms.zip -d /tmp + mv "/tmp/nextcloud_forms-${FORMS_EXPECTED_HASH}" "${FORMS_DIR}" + # Perform config / install + npm --prefix "${FORMS_DIR}" install + composer --ignore-platform-req=ext-dom -d"${FORMS_DIR}" install --no-dev -o + # Place hash marker + cp /forms.hash "${FORMS_DIR}.hash" +fi +if plugin_status "${plugin}" | grep -qE "^disabled"; then + ./occ app:enable forms +fi # #occupgrade diff --git a/dd-apps/docker/nextcloud/nextcloud.yml b/dd-apps/docker/nextcloud/nextcloud.yml index cc92ed4..7c4e037 100644 --- a/dd-apps/docker/nextcloud/nextcloud.yml +++ b/dd-apps/docker/nextcloud/nextcloud.yml @@ -26,7 +26,7 @@ services: dockerfile: Dockerfile args: # Update dd.conf.sample when bumping this version in main - - IMG=${NEXTCLOUD_IMG_OVERRIDE-nextcloud:25.0.4-fpm-alpine} + - IMG=${NEXTCLOUD_IMG_OVERRIDE-nextcloud:25.0.5-fpm-alpine} container_name: dd-apps-nextcloud-app image: registry.dd-work.space/dd/apps-nextcloud:${DD_BUILD:-latest} restart: unless-stopped diff --git a/dd.conf.sample b/dd.conf.sample index f686d32..82d313b 100644 --- a/dd.conf.sample +++ b/dd.conf.sample @@ -172,7 +172,7 @@ MOODLE_MEMORY_LIMIT=128M ## NEXTCLOUD # If enabled overrides nextcloud.yaml default image. # You usually do not want to change this, but instead rely on DD's version. -#NEXTCLOUD_IMG_OVERRIDE=nextcloud:25.0.4-fpm-alpine +#NEXTCLOUD_IMG_OVERRIDE=nextcloud:25.0.5-fpm-alpine ## ONLYOFFICE ONLYOFFICE_IMG=alehoho/oo-ce-docker-license:6.3.1.32