put the database into a subpath

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-05-02 20:12:57 +02:00
parent bf5b7f0f56
commit c6492ef05c

View file

@ -61,6 +61,7 @@ cat << EOL > /tmp/initcontainers.database
command:
- chown
- 999:999
- "-R"
volumeMountsInitContainer:
EOL
# shellcheck disable=SC1083
@ -80,6 +81,11 @@ for variable in "${DEPLOYMENTS[@]}"; do
if [ "$volumeName" != "nextcloud-aio-nextcloud-data" ]; then
sed -i "/^.*volumeMountsInitContainer:/i\ \ \ \ \ \ \ \ \ \ \ \ - /$volumeName" "$variable"
sed -i "/volumeMountsInitContainer:/a\ \ \ \ \ \ \ \ \ \ \ \ - name: $volumeName\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ mountPath: /$volumeName" "$variable"
# Workaround for the database volume
if [ "$volumeName" = nextcloud-aio-database ]; then
sed -i "/mountPath: \/var\/lib\/postgresql\/data/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable"
fi
fi
done
sed -i "s|volumeMountsInitContainer|volumeMounts|" "$variable"