From 9bea6d5619e5592fd7c7767f53690c8c55d9df33 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 12 Feb 2023 20:31:28 +0100 Subject: [PATCH] Major update : "25.0.3" --- nextcloud/CHANGELOG.md | 8 +++ nextcloud/Dockerfile | 59 ++++++++++++------- nextcloud/config.json | 9 +-- .../rootfs/etc/cont-init.d/01-folders.sh | 14 +++++ nextcloud/rootfs/etc/cont-init.d/30-ssl.sh | 20 +++++++ nextcloud/updater.json | 5 +- 6 files changed, 87 insertions(+), 28 deletions(-) create mode 100644 nextcloud/rootfs/etc/cont-init.d/01-folders.sh create mode 100644 nextcloud/rootfs/etc/cont-init.d/30-ssl.sh diff --git a/nextcloud/CHANGELOG.md b/nextcloud/CHANGELOG.md index 708945ba9..90cfadab5 100644 --- a/nextcloud/CHANGELOG.md +++ b/nextcloud/CHANGELOG.md @@ -1,13 +1,21 @@ +## 25.0.3 (12-02-2023) + +- WARNING! : this is a major code update. Make sure to have a full update of /config, /share and your nextcloud addon before updating. I take no responsibility for lost data! +- Update to latest version from linuxserver/docker-nextcloud - WARNING : update to supervisor 2022.11 before installing ## 25.0.0 (20-10-2022) + - Update to latest version from linuxserver/docker-nextcloud ## 24.0.6 (08-10-2022) + - Update to latest version from linuxserver/docker-nextcloud ## 24.0.5 (09-09-2022) + - Update to latest version from linuxserver/docker-nextcloud + ## 24.0.4 (13-08-2022) - Update to latest version from linuxserver/docker-nextcloud diff --git a/nextcloud/Dockerfile b/nextcloud/Dockerfile index 1464037f9..f2ed9c9f3 100644 --- a/nextcloud/Dockerfile +++ b/nextcloud/Dockerfile @@ -17,7 +17,7 @@ ARG BUILD_FROM ARG BUILD_VERSION ARG BUILD_ARCH -ARG BUILD_UPSTREAM="25.0.0" +ARG BUILD_UPSTREAM="25.0.3" FROM ${BUILD_FROM}${BUILD_UPSTREAM} ################## @@ -29,31 +29,48 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_SERVICES_GRACETIME=0 -ENV NEXTCLOUD_PATH="/data/config/www/nextcloud" +# Specific modifications +ARG CONFIGLOCATION="/share/nextcloud" +RUN \ + # Change default data location + for file in $(grep -Esril "/data" /etc /defaults); do sed -Ei "s=(/data)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done && \ + \ + # modify data limits file + sed -i \ + -e 's/upload_max_fileize=1024M/upload_max_fileize=10240M/g' \ + -e 's/post_max_size=1024M/post_max_size=10240M/g' \ + /etc/php*/php.ini || true # Global LSIO modifications ARG CONFIGLOCATION="/data/config" -# hadolint ignore=SC2046,SC2013,SC2086 +# hadolint ignore=SC2015, SC2013, SC2086 RUN \ - # Remove upstream file - rm -rf /etc/cont-init.d/10-adduser /etc/cont-init.d/30-keygen /etc/cont-init.d/40-config /etc/cont-init.d/50-install /etc/cont-init.d/60-memcache /etc/cont-init.d/70-aliases \ - # Make permissions - && chmod +x /defaults/nextcloud-perms.sh \ - # default folders - && for file in $(grep -Esril "/data[ '\"/]|/data\$" /etc /defaults); do sed -Ei "s=(/data)+(/| |$|\"|\')=/share/nextcloud\2=g" $file; done \ - && for file in $(grep -Esril "/config[ '\"/]|/config\$" /etc /defaults); do sed -Ei "s=(/config)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done \ - # modify data limits file - && sed -i \ - -e 's/upload_max_fileize=1024M/upload_max_fileize=10240M/g' \ - -e 's/post_max_size=1024M/post_max_size=10240M/g' \ - /etc/php*/php.ini \ - # Correct initial directory - && sed -i "s|/data|%%datadirectory%%|g" /defaults/config.php + # Avoid custom-init.d duplications + for file in $(grep -sril 'Potential tampering with custom' /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do rm -f $file; done \ + \ + # Create new config folder if needed + && for file in $(grep -srl "PUID" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i "1a mkdir -p $CONFIGLOCATION" $file; done \ + \ + # Allow UID and GID setting + && for file in $(grep -srl "PUID" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i 's/bash/bashio/g' $file && sed -i '1a PUID="$(if bashio::config.has_value "PUID"; then bashio::config "PUID"; else echo "0"; fi)"' $file && sed -i '1a PGID="$(if bashio::config.has_value "PGID"; then bashio::config "PGID"; else echo "0"; fi)"' $file; done \ + \ + # Search occurences of /config and change it to the expected new config + && for file in $(grep -Esril "/config" /etc /defaults); do sed -Ei "s=(/config)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done \ + \ + # Avoid chmod /config + && for file in /etc/services.d/*/* /etc/cont-init.d/* /etc/s6-overlay/s6-rc.d/*/*;do if [ -f $file ] && [[ ! -z $(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' $file) ]] ; then sed -i "s|/config$|/data|g" $file; fi ;done \ + \ + # Docker mods addition + #&& if [ -f /docker-mods ]; then sed -i 's|bash|bashio|g' /docker-mods && sed -i "1a if bashio::config.has_value \"DOCKER_MODS\"; then DOCKER_MODS=\$(bashio::config \"DOCKER_MODS\"); fi" /docker-mods; fi \ + \ + # Replace lsiown if not found + && if [ ! -f /usr/bin/lsiown ]; then for file in $(grep -sril "lsiown" /etc); do sed -i "s|lsiown|chown|g" $file; done; fi +# Correct modifications +ARG CONFIGLOCATION="/www/nextcloud/config" +# hadolint ignore=SC2015, SC2013, SC2086 RUN \ - # Correct ssl path - sed -i "s|/data/config/keys|/ssl/nextcloud/keys|g" /defaults/nginx/site-confs/default.conf.sample \ - && sed -i "s|client_max_body_size 512M;|client_max_body_size 10240M;|g" /defaults/nginx/site-confs/default.conf.sample + for file in $(grep -Esril "/www/nextcloud/data/config" /etc /defaults); do sed -Ei "s=(/www/nextcloud/data/config)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done ################## # 3 Install apps # @@ -79,7 +96,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get && chmod -R 755 /etc/cont-init.d # Manual apps -ENV PACKAGES="gcompat wget" +ENV PACKAGES="gcompat" # Automatic apps & bashio # hadolint ignore=SC2015 diff --git a/nextcloud/config.json b/nextcloud/config.json index 1a59b7bc3..90d94353b 100644 --- a/nextcloud/config.json +++ b/nextcloud/config.json @@ -42,6 +42,9 @@ "/dev/nvme1", "/dev/nvme2" ], + "environment": { + "NEXTCLOUD_PATH": "/data/config/www/nextcloud" + }, "hassio_api": true, "image": "ghcr.io/alexbelgium/nextcloud_ocr-{arch}", "ingress_port": 0, @@ -61,7 +64,6 @@ "PUID": 1000, "additional_apps": "inotify-tools", "certfile": "fullchain.pem", - "data_directory": "/share/nextcloud", "elasticsearch_server": "", "keyfile": "privkey.pem", "trusted_domains": "your-domain, your-domain2", @@ -91,7 +93,6 @@ "certfile": "str", "cifspassword": "str?", "cifsusername": "str?", - "data_directory": "str", "elasticsearch_server": "str?", "keyfile": "str", "localdisks": "str?", @@ -105,6 +106,6 @@ "slug": "nextcloud_ocr", "uart": true, "url": "https://github.com/alexbelgium/hassio-addons/tree/master/nextcloud", - "version": "25.0.0-11", + "version": "25.0.3", "webui": "https://[HOST]:[PORT:443]" -} +} \ No newline at end of file diff --git a/nextcloud/rootfs/etc/cont-init.d/01-folders.sh b/nextcloud/rootfs/etc/cont-init.d/01-folders.sh new file mode 100644 index 000000000..f8fa4db22 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/01-folders.sh @@ -0,0 +1,14 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +PUID=$(bashio::config "PUID") +PGID=$(bashio::config "PGID") +datadirectory=$(bashio::config 'data_directory') + +bashio::log.info "Checking permissions" +mkdir -p /data/config +mkdir -p "$datadirectory" +chmod 755 -R "$datadirectory" +chmod 755 -R /data/config +chown -R "$PUID:$PGID" "$datadirectory" +chown -R "$PUID:$PGID" "/data/config" diff --git a/nextcloud/rootfs/etc/cont-init.d/30-ssl.sh b/nextcloud/rootfs/etc/cont-init.d/30-ssl.sh new file mode 100644 index 000000000..458fd392a --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/30-ssl.sh @@ -0,0 +1,20 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +if bashio::config.true 'use_own_certs'; then + + bashio::log.info "Using referenced ssl certificates..." + CERTFILE=$(bashio::config 'certfile') + KEYFILE=$(bashio::config 'keyfile') + + #Check if files exist + echo "... checking if referenced files exist" + [ ! -f /ssl/"$CERTFILE" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$CERTFILE not found" && bashio::exit.nok + [ ! -f /ssl/"$KEYFILE" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$KEYFILE not found" && bashio::exit.nok + + [[ -f /config/keys/cert.key ]] && rm /config/keys/cert.key + [[ -f /config/keys/cert.crt ]] && rm /config/keys/cert.crt + cp /ssl/"$CERTFILE" config/keys/cert.crt + cp /ssl/"$CERTFILE" config/keys/cert.key + +fi diff --git a/nextcloud/updater.json b/nextcloud/updater.json index 1974e548e..5602b5a7d 100644 --- a/nextcloud/updater.json +++ b/nextcloud/updater.json @@ -1,9 +1,8 @@ { "last_update": "20-10-2022", - "paused": true, "repository": "alexbelgium/hassio-addons", "slug": "nextcloud", "source": "github", "upstream_repo": "linuxserver/docker-nextcloud", - "upstream_version": "25.0.0" -} + "upstream_version": "25.0.3" +} \ No newline at end of file