7977c0ecab
preserving pre-existing configuration and data.
48 lines
1.4 KiB
Bash
48 lines
1.4 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
ECHO_CMD=echo
|
|
GREP=/usr/bin/grep
|
|
PW=/usr/sbin/pw
|
|
|
|
FTPUSERS=/etc/ftpusers
|
|
GNATSDBDIR=%%GNATSDBDIR%%
|
|
|
|
case $2 in
|
|
PRE-INSTALL)
|
|
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."
|
|
else
|
|
${ECHO_CMD}
|
|
${ECHO_CMD} "The FreeBSD standard userid for gnats is 61, but this system"
|
|
${ECHO_CMD} "has already a different account with this userid:"
|
|
${ECHO_CMD}
|
|
${PW} usershow -u 61 -P
|
|
${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"
|
|
${ECHO_CMD} " ${PW} useradd -n gnats -g daemon \\"
|
|
${ECHO_CMD} " -d ${GNATSDBDIR} -c 'GNATS database owner' -h -"
|
|
${ECHO_CMD} "and retry installing this package"
|
|
${ECHO_CMD}
|
|
exit 1
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|