use chown on rsync to /data and /config directories

The lsiown command explicitly avoids touching symlinks, allowing root
owned symlinks to bleed into PUID/PGID controlled areas.

Use the chown arguments when using rsync to copy files to /data and
/config to prevent creating symlinks with root permissions.

Signed-off-by: Randolph Sapp <rs@ti.com>
This commit is contained in:
Randolph Sapp 2025-08-18 01:31:28 -05:00
parent bf3466672a
commit f850beb81e

View File

@ -81,11 +81,11 @@ if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_ins
rsync -rlD --exclude-from=/app/upgrade.exclude /app/www/src/ /app/www/public/
for dir in apps config themes; do
if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_upgrade ]] || [[ -z "$(ls -A /app/www/public/${dir} 2>/dev/null)" ]]; then
rsync -rlD --include "/${dir}" --exclude '/*' /app/www/src/ /config/www/nextcloud/
rsync -rlD --chown=abc:abc --include "/${dir}" --exclude '/*' /app/www/src/ /config/www/nextcloud/
fi
done
if [[ -z "$(ls -A /data/ 2>/dev/null)" ]]; then
rsync -rlD --include "/data" --exclude '/*' /app/www/src/ /
rsync -rlD --chown=abc:abc --include "/data" --exclude '/*' /app/www/src/ /
fi
echo "Setting permissions"