6d71ccce3a
- Fix a problem on pkg-install, when umask is not default, it create dirs with wrong permissions [2] - Bump PORTREVISION PR: ports/120885 [2] Submitted by: dmx@dmx.org.ru [2] Noticed by: havp pointyhat via pav
48 lines
1.1 KiB
Bash
48 lines
1.1 KiB
Bash
#!/bin/sh
|
|
# $FreeBSD: /tmp/pcvs/ports/security/clamav/files/pkg-install.in,v 1.5 2008-02-21 13:19:50 garga Exp $
|
|
|
|
PREFIX=${PKG_PREFIX:-%%PREFIX%%}
|
|
|
|
CLAMAVUSER=%%CLAMAVUSER%%
|
|
CLAMAVGROUP=%%CLAMAVGROUP%%
|
|
UID=106
|
|
GID=$UID
|
|
|
|
DBDIR=%%DBDIR%%
|
|
LOGDIR=%%LOGDIR%%
|
|
RUNDIR=%%RUNDIR%%
|
|
|
|
PW="pw"
|
|
CHOWN="chown"
|
|
INSTALL_DIR="install -d -o ${CLAMAVUSER} -g ${CLAMAVGROUP} -m 0755"
|
|
|
|
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
|
|
${INSTALL_DIR} ${DBDIR} ${LOGDIR} ${RUNDIR}
|
|
${CHOWN} -R ${CLAMAVUSER}:${CLAMAVGROUP} ${DBDIR} ${LOGDIR} ${RUNDIR}
|
|
fi
|
|
|
|
exit 0
|