File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
drupal/rootfs/etc/s6-overlay/scripts Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 66if [[ " ${DEVELOPMENT_ENVIRONMENT} " != " true" ]]; then
77 exit 0
88fi
9+
910if [[ -z " ${UID} " ]]; then
1011 exit 0
1112fi
1213
13- # Get the current user for this UID (if any)
14- EXISTING_USER=$( getent passwd ${UID} | cut -d: -f1)
14+ # Get the current user for this UID (if any) - don't fail if not found
15+ EXISTING_USER=$( getent passwd " ${UID} " 2> /dev/null | cut -d: -f1 || true )
1516
1617if [ -z " $EXISTING_USER " ]; then
1718 # UID doesn't exist, safe to change nginx user
18- usermod -u ${UID} nginx
19+ usermod -u " ${UID} " nginx
1920elif [ " $EXISTING_USER " != " nginx" ]; then
2021 # UID exists but belongs to another user
21- usermod -u $(( UID + 10000 )) " $EXISTING_USER "
22- usermod -u ${UID} nginx
22+ # Move existing user out of the way
23+ NEW_UID=$(( UID + 10000 ))
24+ usermod -u " ${NEW_UID} " " $EXISTING_USER " || true
25+ usermod -u " ${UID} " nginx
2326fi
2427
28+ # Fix ownership if needed
2529if [[ " $( stat -c %u /var/www/drupal) " != " ${UID} " ]]; then
2630 chown -R nginx:nginx /var/www/drupal
2731fi
2832
29- # always ensure nginx has access to the socket
33+ # Always ensure nginx has access to the socket
3034chown -R nginx:nginx /run/php-fpm83
31-
You can’t perform that action at this time.
0 commit comments