From 9ca9b54cb0501841fd7cd24a5ede079207b8fb88 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 May 2026 13:00:20 +0000 Subject: [PATCH] fix(nextcloud): use /share/nextcloud as default data directory and add data_location option Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/3206d642-bf8c-49cc-b828-1ca2fe084ac7 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- nextcloud/CHANGELOG.md | 4 ++++ nextcloud/config.yaml | 3 ++- .../rootfs/etc/cont-init.d/01-folders.sh | 24 +++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/nextcloud/CHANGELOG.md b/nextcloud/CHANGELOG.md index 926a76f4a9..c55eff2a65 100644 --- a/nextcloud/CHANGELOG.md +++ b/nextcloud/CHANGELOG.md @@ -1,4 +1,8 @@ +## 33.0.3-2 (2026-05-29) +- Fix: Change default data directory for new installations from /config/data to /share/nextcloud +- Add data_location option to allow users to customize the Nextcloud data directory + ## 33.0.3 (2026-05-02) - Update to latest version from linuxserver/docker-nextcloud (changelog : https://github.com/linuxserver/docker-nextcloud/releases) diff --git a/nextcloud/config.yaml b/nextcloud/config.yaml index 11d12002e2..4c42dd33fe 100644 --- a/nextcloud/config.yaml +++ b/nextcloud/config.yaml @@ -142,6 +142,7 @@ schema: keyfile: str localdisks: str? networkdisks: str? + data_location: str? skip_permissions_check: bool? trusted_domains: str? use_own_certs: bool @@ -151,5 +152,5 @@ slug: nextcloud_ocr uart: true udev: true url: https://github.com/alexbelgium/hassio-addons/tree/master/nextcloud -version: "33.0.3" +version: "33.0.3-2" webui: https://[HOST]:[PORT:443] diff --git a/nextcloud/rootfs/etc/cont-init.d/01-folders.sh b/nextcloud/rootfs/etc/cont-init.d/01-folders.sh index ebdb48a6b0..738b4a3070 100755 --- a/nextcloud/rootfs/etc/cont-init.d/01-folders.sh +++ b/nextcloud/rootfs/etc/cont-init.d/01-folders.sh @@ -16,17 +16,31 @@ mkdir -p /data/config chmod 755 -R /data/config chown -R "$PUID:$PGID" "/data/config" +# Check data_location option +if bashio::config.has_value "data_location"; then + custom_data_location="$(bashio::config 'data_location')" + # Validate path is in an allowed location + location_ok="" + for location in "/share" "/config" "/data" "/mnt"; do + if [[ "$custom_data_location" == "$location"* ]]; then + location_ok=true + fi + done + if [ -z "$location_ok" ]; then + bashio::log.warning "Your data_location value can only be set in /share, /config, /data or /mnt. Falling back to default." + custom_data_location="" + fi +fi + # Check current version if [ -f /data/config/www/nextcloud/config/config.php ]; then datadirectory="$(sed -n "s|.*datadirectory.*' => '*\(.*[^ ]\) *',.*|\1|p" /data/config/www/nextcloud/config/config.php)" echo "... data directory detected : $datadirectory" else - datadirectory=/config/data + datadirectory="${custom_data_location:-/share/nextcloud}" echo "Nextcloud is not installed yet, the default data directory is : $datadirectory. You can change it during nextcloud installation." - mkdir -p /config/data - chmod 755 /config/data - mkdir -p /share/nextcloud - chmod 755 /share/nextcloud + mkdir -p "$datadirectory" + chmod 755 "$datadirectory" fi # Is the directory valid