diff options
Diffstat (limited to 'net/openldap24-server/pkg-install')
-rw-r--r-- | net/openldap24-server/pkg-install | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/net/openldap24-server/pkg-install b/net/openldap24-server/pkg-install new file mode 100644 index 000000000000..aa9b0cf46da9 --- /dev/null +++ b/net/openldap24-server/pkg-install @@ -0,0 +1,44 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +CHOWN=/usr/sbin/chown +ECHO_CMD=echo +GREP=/usr/bin/grep +PKG_INFO=/usr/sbin/pkg_info +PW=/usr/sbin/pw + +FTPUSERS=/etc/ftpusers + +case $2 in +PRE-INSTALL) + if ! ${PW} usershow -n ldap >/dev/null 2>&1; then + ${ECHO_CMD} + if ! ${PW} groupshow -n ldap >/dev/null 2>&1; then + if ! ${PW} groupadd -n ldap -g 389; then + ${ECHO_CMD} "*** Failed to add a group ldap with id 389." + ${ECHO_CMD} + ${ECHO_CMD} "Please add the ldap user manually with" + ${ECHO_CMD} " ${PW} useradd -n ldap -g ldap -c 'OpenLDAP server' \\" + ${ECHO_CMD} " -d /nonexistent -s /sbin/nologin -h -" + ${ECHO_CMD} "and retry installing this package." + exit 1 + fi + ${ECHO_CMD} "===> Group 'ldap' created." + fi + if ! ${PW} useradd -n ldap -u 389 -g ldap -c 'OpenLDAP Server' \ + -d /nonexistent -s /sbin/nologin -h -; then + ${ECHO_CMD} "*** Failed to add an user ldap with id 389." + ${ECHO_CMD} + ${ECHO_CMD} "Please add the ldap user manually with" + ${ECHO_CMD} " ${PW} useradd -n ldap -g ldap -c 'OpenLDAP server' \\" + ${ECHO_CMD} " -d /nonexistent -s /sbin/nologin -h -" + ${ECHO_CMD} "and retry installing this package." + exit 1 + fi + ${GREP} -qs '^ldap$' ${FTPUSERS} || ${ECHO_CMD} ldap >> ${FTPUSERS} + ${ECHO_CMD} "===> Account 'ldap' created." + fi + ;; +esac |