This repository was archived by the owner on Jul 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,16 @@ set_apache_server_name ()
5959 /etc/httpd/conf/httpd.conf
6060}
6161
62+ set_new_username ()
63+ {
64+ local USER_FROM=${1:- app}
65+ local USER_TO=${2:- app}
66+
67+ if [[ ${USER_TO} != root ]] && [[ ${USER_FROM} != root ]] && [[ ${USER_TO} != ${USER_FROM} ]] && [[ -n $( getent passwd ${USER_FROM} ) ]]; then
68+ usermod -l ${USER_TO} ${USER_FROM}
69+ fi
70+ }
71+
6272APP_HOME_DIR_TEMPLATE=" /var/www/.app-skel"
6373
6474OPTS_APACHE_EXTENDED_STATUS_ENABLED=" ${APACHE_EXTENDED_STATUS_ENABLED:- false} "
@@ -157,13 +167,8 @@ else
157167fi
158168
159169# Set the service user / service group user
160- if getent passwd app && [[ ${OPTS_SERVICE_USER} != app ]]; then
161- usermod -l ${OPTS_SERVICE_USER} app
162- fi
163-
164- if getent passwd app-www && [[ ${OPTS_SERVICE_USER_GROUP} != app-www ]]; then
165- usermod -l ${OPTS_SERVICE_USER_GROUP} app-www
166- fi
170+ set_new_username app ${OPTS_SERVICE_USER}
171+ set_new_username app-www ${OPTS_SERVICE_USER_GROUP}
167172
168173# Set the Apache (run) service user/group
169174if [[ ${OPTS_SUEXECUSERGROUP} == true ]]; then
You can’t perform that action at this time.
0 commit comments