freebsd-ports/security/clamav/files/pkg-install.in
Renato Botelho 2f5188f16a - Fix 'integer constant is too large for "long" type' warning [1]
- Convert one patch to REINPLACE_CMD
- Force to use ${PREFIX}/lib/libmilter.a if it's installed
- Fix sendmail binary detection using --with-sendmail instead SENDMAIL envvar
- Add EXPERIMENTAL OPTION to build with --enable-experimental
- Remove DESTDIR/TARGETDIR since it's useless for now
- Bump PORTREVISION

Submitted by:	stas@ at #bsdports [1]
Thanks to:	stas@ and simon@ [1]
2007-02-18 16:12:37 +00:00

56 lines
1.3 KiB
Bash

#!/bin/sh
# $FreeBSD: /tmp/pcvs/ports/security/clamav/files/pkg-install.in,v 1.4 2007-02-18 16:12:37 garga Exp $
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
CLAMAVUSER=%%CLAMAVUSER%%
CLAMAVGROUP=%%CLAMAVGROUP%%
UID=106
GID=$UID
DBDIR=%%DBDIR%%
LOGDIR=%%LOGDIR%%
RUNDIR=%%RUNDIR%%
PW="pw"
CHOWN="chown"
MKDIR="mkdir -p"
if [ "$2" = "PRE-INSTALL" ]; then
if ! ${PW} groupshow ${CLAMAVGROUP} 2>/dev/null 1>&2; then
if ${PW} groupadd ${CLAMAVGROUP} -g $GID; then
echo "=> Added group \"${CLAMAVGROUP}\"."
else
echo "=> Adding group \"${CLAMAVGROUP}\" failed..."
exit 1
fi
fi
if ! ${PW} usershow ${CLAMAVUSER} 2>/dev/null 1>&2; then
if ${PW} useradd ${CLAMAVUSER} -u $UID -g ${CLAMAVGROUP} -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "Clam Antivirus"; \
then
${PW} groupmod mail -m ${CLAMAVUSER}
echo "=> Added user \"${CLAMAVUSER}\"."
else
echo "=> Adding user \"${CLAMAVUSER}\" failed..."
exit 1
fi
fi
elif [ "$2" = "POST-INSTALL" ]; then
[ ! -d "${DBDIR}" ] && (${MKDIR} ${DBDIR} || exit 1)
${CHOWN} -R ${CLAMAVUSER}:${CLAMAVGROUP} ${DBDIR} || exit 1
[ ! -d "${LOGDIR}" ] && (${MKDIR} ${LOGDIR} || exit 1)
${CHOWN} -R ${CLAMAVUSER}:${CLAMAVGROUP} ${LOGDIR} || exit 1
[ ! -d "${RUNDIR}" ] && (${MKDIR} ${RUNDIR} || exit 1)
${CHOWN} -R ${CLAMAVUSER}:${CLAMAVGROUP} ${RUNDIR} || exit 1
fi
exit 0