2003-09-20 15:16:46 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
ECHO_CMD=echo
|
|
|
|
GREP=/usr/bin/grep
|
|
|
|
PW=/usr/sbin/pw
|
2003-10-09 03:17:43 +02:00
|
|
|
|
2003-09-20 15:16:46 +02:00
|
|
|
FTPUSERS=/etc/ftpusers
|
2003-10-09 03:17:43 +02:00
|
|
|
GNATSDBDIR=%%GNATSDBDIR%%
|
2003-09-20 15:16:46 +02:00
|
|
|
|
|
|
|
case $2 in
|
|
|
|
PRE-INSTALL)
|
2003-10-09 03:17:43 +02:00
|
|
|
if [ ! -x ${PW} ]; then
|
|
|
|
${ECHO_CMD} "Your system is missing the \`pw' command."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ${PW} usershow -n gnats >/dev/null 2>&1; then
|
|
|
|
if [ "`pw usershow -n gnats | awk -F: '{print $9}'`" != "${GNATSDBDIR}" ]; then
|
|
|
|
${PW} usermod -n gnats -d "${GNATSDBDIR}" 2>/dev/null
|
|
|
|
${ECHO_CMD} "===> Account \`gnats' updated."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ${PW} useradd -n gnats -u 61 -g 1 -d "${GNATSDBDIR}" \
|
|
|
|
-c "GNATS database owner" -h -; then
|
|
|
|
${GREP} -qs '^gnats$' ${FTPUSERS} || ${ECHO_CMD} gnats >> ${FTPUSERS}
|
|
|
|
${ECHO_CMD} "===> Account \`gnats' created."
|
2003-09-20 15:16:46 +02:00
|
|
|
else
|
|
|
|
${ECHO_CMD}
|
|
|
|
${ECHO_CMD} "The FreeBSD standard userid for gnats is 61, but this system"
|
2003-10-09 03:17:43 +02:00
|
|
|
${ECHO_CMD} "has already a different account with this userid:"
|
|
|
|
${ECHO_CMD}
|
|
|
|
${PW} usershow -u 61 -P
|
2003-09-20 15:16:46 +02:00
|
|
|
${ECHO_CMD}
|
|
|
|
${ECHO_CMD} "You can either delete this account (which may be dangerous) with"
|
|
|
|
${ECHO_CMD} " ${PW} userdel -u 61"
|
|
|
|
${ECHO_CMD} "or add the gnats user with an other userid with"
|
2003-10-09 03:17:43 +02:00
|
|
|
${ECHO_CMD} " ${PW} useradd -n gnats -g daemon \\"
|
|
|
|
${ECHO_CMD} " -d ${GNATSDBDIR} -c 'GNATS database owner' -h -"
|
2003-09-20 15:16:46 +02:00
|
|
|
${ECHO_CMD} "and retry installing this package"
|
|
|
|
${ECHO_CMD}
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|