ports/net/openldap24-server/files/pkg-install.in
Xin LI c95c4c34f7 Update to 2.4.2alpha after repocopy.
Please note that this is not connected to build at this time, as
the port infrastructure lacks some necessary support for this
OpenLDAP release which will be tested on pointyhat soon.

If you really want to try this out please apply the patch found
in ports/97515 or
  http://www.delphij.net/patch-bsd.port.mk
in order to get infrastructure support for it.

This work is heavily based on ports/96165 submitted by
Joerg Pulz <Joerg Pulz frm2 tum de>.

Approved by:	sem (mentor, implicit)
2006-05-26 02:44:25 +00:00

44 lines
1.4 KiB
Bash

#!/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