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>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-29 13:00:20 +00:00
committed by GitHub
parent 253909d46d
commit 9ca9b54cb0
3 changed files with 25 additions and 6 deletions

View File

@@ -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)

View File

@@ -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]

View File

@@ -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