diff --git a/+POST_INSTALL b/+POST_INSTALL index 88d5baed2..c9536cde1 100644 --- a/+POST_INSTALL +++ b/+POST_INSTALL @@ -4,20 +4,22 @@ UID=789 GROUP=${USER} GID=${UID} -if ! ${PW} groupshow ${GROUP} >/dev/null 2>&1; then - echo "Creating group '${GROUP}' with gid '${GID}'" - ${PW} groupadd ${GROUP} -g ${GID} -else - echo "Using existing group '${GROUP}'" +PW_ARG=add +if ${PW} groupshow ${GROUP} >/dev/null 2>&1; then + PW_ARG=mod fi -if ! ${PW} usershow ${USER} >/dev/null 2>&1; then - echo "Creating user '${USER}' with uid '${UID}'" - ${PW} useradd ${USER} -u ${UID} -g ${GID} -c "World Wide Web Only" -d /nonexistent -s /usr/sbin/nologin -else - echo "Using existing user '${USER}'" +echo "Creating group '${GROUP}' with gid '${GID}'" +${PW} group${PW_ARG} ${GROUP} -g ${GID} + +PW_ARG=add +if ${PW} usershow ${USER} >/dev/null 2>&1; then + PW_ARG=mod fi +echo "Creating user '${USER}' with uid '${UID}'" +${PW} user${PW_ARG} ${USER} -u ${UID} -g ${GID} -c "World Wide Web Only" -d /nonexistent -s /usr/sbin/nologin + echo "Updating /etc/shells" cp /etc/shells /etc/shells.bak (grep -v /usr/local/sbin/opnsense-shell /etc/shells.bak; \