#!/bin/sh if [ "${IEP_ROOT}" = 0 ] ; then log "Running as non-root: user/group configuration may be excessive" fi unset _NGX_USER _NGX_GROUP ## here should be SANE defaults (!) _NGX_USER=angie _NGX_GROUP=angie if [ -z "${NGX_USER:-}" ] ; then NGX_USER=${_NGX_USER} else case "${NGX_USER}" in "${_NGX_USER}" ) ;; [1-9]* ) ## numeric id - remap to name _user_name=$(getent passwd "${NGX_USER}" | cut -d: -f1) if [ -n "${_user_name}" ] ; then NGX_USER=${_user_name} else log_always "NGX_USER: ID is not known in /etc/passwd: ${NGX_USER}" log_always "setting NGX_USER=${_NGX_USER}" NGX_USER=${_NGX_USER} fi unset _user_name ;; * ) _user_name=$(getent passwd "${NGX_USER}" | cut -d: -f1) if [ -n "${_user_name}" ] ; then NGX_USER=${_user_name} else log_always "NGX_USER: name is not known in /etc/passwd: ${NGX_USER}" log_always "setting NGX_USER=${_NGX_USER}" NGX_USER=${_NGX_USER} fi unset _user_name ;; esac fi export NGX_USER if [ -z "${NGX_GROUP:-}" ] ; then NGX_GROUP=${_NGX_GROUP} else case "${NGX_GROUP}" in "${_NGX_GROUP}" ) ;; [1-9]* ) ## numeric id - remap to name _group_name=$(getent group "${NGX_GROUP}" | cut -d: -f1) if [ -n "${_group_name}" ] ; then NGX_GROUP=${_group_name} else log_always "NGX_GROUP: ID is not known in /etc/group: ${NGX_GROUP}" log_always "setting NGX_GROUP=${_NGX_GROUP}" NGX_GROUP=${_NGX_GROUP} fi unset _group_name ;; * ) _group_name=$(getent group "${NGX_GROUP}" | cut -d: -f1) if [ -n "${_group_name}" ] ; then NGX_GROUP=${_group_name} else log_always "NGX_GROUP: name is not known in /etc/group: ${NGX_GROUP}" log_always "setting NGX_GROUP=${_NGX_GROUP}" NGX_GROUP=${_NGX_GROUP} fi unset _group_name ;; esac fi export NGX_GROUP unset _NGX_USER _NGX_GROUP