adjust permissions for Nextcloud's datadir

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-02-04 17:03:42 +01:00
parent a5f9ff9c74
commit d74ed475df
2 changed files with 5 additions and 5 deletions

View file

@ -28,13 +28,10 @@ spec:
- chmod
- "777"
- /nextcloud-aio-nextcloud
- /nextcloud-aio-nextcloud-data
- /nextcloud-aio-nextcloud-trusted-cacerts
volumeMounts:
- name: nextcloud-aio-nextcloud-trusted-cacerts
mountPath: /nextcloud-aio-nextcloud-trusted-cacerts
- name: nextcloud-aio-nextcloud-data
mountPath: /nextcloud-aio-nextcloud-data
- name: nextcloud-aio-nextcloud
mountPath: /nextcloud-aio-nextcloud
containers:

View file

@ -73,8 +73,11 @@ for variable in "${DEPLOYMENTS[@]}"; do
volumeNames="$(grep -A1 mountPath "$variable" | grep -v mountPath | sed 's|.*name: ||' | sed '/^--$/d')"
mapfile -t volumeNames <<< "$volumeNames"
for volumeName in "${volumeNames[@]}"; do
# The Nextcloud container runs as root user and sets the correct permissions automatically for the data-dir if the www-data user cannot write to it
if [ "$volumeName" != "nextcloud-aio-nextcloud-data" ]; then
sed -i "/^.*volumeMountsInitContainer:/i\ \ \ \ \ \ \ \ \ \ \ \ - /$volumeName" "$variable"
sed -i "/volumeMountsInitContainer:/a\ \ \ \ \ \ \ \ \ \ \ \ - name: $volumeName\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ mountPath: /$volumeName" "$variable"
fi
done
sed -i "s|volumeMountsInitContainer|volumeMounts|" "$variable"
if grep -q claimName "$variable"; then