2003-01-20 04:41:52 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2003-10-03 15:31:26 +02:00
|
|
|
if [ ! "$2" = "PRE-INSTALL" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2003-09-26 19:34:19 +02:00
|
|
|
if [ -z "${CLAMAVUSER}" ]; then
|
|
|
|
CLAMAVUSER=clamav
|
|
|
|
fi
|
2003-06-25 14:33:31 +02:00
|
|
|
|
2003-09-30 05:39:11 +02:00
|
|
|
if [ -z "${CLAMAVGROUP}" ]; then
|
|
|
|
CLAMAVGROUP=clamav
|
2003-06-25 14:33:31 +02:00
|
|
|
fi
|
2003-01-20 04:41:52 +01:00
|
|
|
|
2003-09-30 05:39:11 +02:00
|
|
|
CLAMRUN=/var/run/clamav
|
|
|
|
CLAMLOG=/var/log/clamav
|
2003-01-20 04:41:52 +01:00
|
|
|
|
2003-09-26 19:34:19 +02:00
|
|
|
echo "===> Adding user \"${CLAMAVUSER}\" if necessary."
|
|
|
|
if ! pw groupshow "${CLAMAVGROUP}" 2>/dev/null 1>&2; then
|
|
|
|
if pw groupadd ${CLAMAVGROUP}; then
|
|
|
|
echo "===> Added group \"${CLAMAVGROUP}\"."
|
2003-01-20 04:41:52 +01:00
|
|
|
else
|
2003-09-26 19:34:19 +02:00
|
|
|
echo "===> Adding group \"${CLAMAVGROUP}\" failed..."
|
2003-01-20 04:41:52 +01:00
|
|
|
exit 1
|
2003-09-26 19:34:19 +02:00
|
|
|
fi
|
2003-01-20 04:41:52 +01:00
|
|
|
fi
|
|
|
|
|
2003-09-26 19:34:19 +02:00
|
|
|
if ! pw usershow "${CLAMAVUSER}" 2>/dev/null 1>&2; then
|
|
|
|
if pw useradd ${CLAMAVUSER} -g ${CLAMAVGROUP} -h - \
|
2003-09-30 05:39:11 +02:00
|
|
|
-s "/usr/sbin/nologin" -d "/nonexistent" \
|
2003-09-26 19:34:19 +02:00
|
|
|
-c "Clam Antivirus"; \
|
2003-01-20 04:41:52 +01:00
|
|
|
then
|
2003-09-26 19:34:19 +02:00
|
|
|
echo "===> Added user \"${CLAMAVUSER}\"."
|
2003-01-20 04:41:52 +01:00
|
|
|
else
|
2003-09-26 19:34:19 +02:00
|
|
|
echo "===> Adding user \"${CLAMAVUSER}\" failed..."
|
2003-01-20 04:41:52 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2003-09-26 19:34:19 +02:00
|
|
|
|
|
|
|
echo "===> Setting permissions..."
|
2003-09-30 05:39:11 +02:00
|
|
|
mkdir -p "${CLAMRUN}"
|
|
|
|
chown "${CLAMAVUSER}:${CLAMAVGROUP}" "${CLAMRUN}"
|
|
|
|
|
|
|
|
mkdir -p "${CLAMLOG}"
|
|
|
|
chown "${CLAMAVUSER}:${CLAMAVGROUP}" "${CLAMLOG}"
|
2003-09-26 19:34:19 +02:00
|
|
|
|
2003-01-20 04:41:52 +01:00
|
|
|
exit 0
|