Update 30-ownership.sh

Make setting file permissions optional with SKIP_FILE_OWNERSHIP environment variable.
This commit is contained in:
ian351c 2024-06-05 10:50:14 -04:00 committed by GitHub
parent d3a654b546
commit f4c05cf9cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,8 +3,13 @@
set -e
log_info 'Setting ownership ...'
# Lowercase
SKIP_FILE_OWNERSHIP=$(echo "${SKIP_FILE_OWNERSHIP:-}" | tr '[:upper:]' '[:lower:]')
if [ "$SKIP_FILE_OWNERSHIP" == "false" ] || [ "$SKIP_FILE_OWNERSHIP" == "off" ] || [ "$SKIP_FILE_OWNERSHIP" == "0" ] || [ "$SKIP_FILE_OWNERSHIP" == "no" ]; then
log_info 'Skipping ownership, use only with caution ...'
else
log_info 'Setting ownership ...'
# root
chown root /tmp/nginx
@ -26,3 +31,4 @@ chown -R "$PUID:$PGID" /etc/nginx/conf.d
# Prevents errors when installing python certbot plugins when non-root
chown "$PUID:$PGID" /opt/certbot /opt/certbot/bin
find /opt/certbot/lib/python*/site-packages -not -user "$PUID" -execdir chown "$PUID:$PGID" {} \+
fi