35de7eb27a
- The install doesn't delete the database anymore - Don't remove the database on deinstall - Use OPTIONS target - handle all config install via the port You have to run freshclam manually once after upgrade to restore the database. PR: 62653 Submitted by: rob@debank.tv - Fix deinstall when no database was installed. Submitted by: dinoex
46 lines
1 KiB
Bash
46 lines
1 KiB
Bash
#!/bin/sh
|
|
|
|
if [ "$2" = "PRE-INSTALL" ]; then
|
|
|
|
if [ -z "${CLAMAVUSER}" ]; then
|
|
CLAMAVUSER=clamav
|
|
fi
|
|
|
|
if [ -z "${CLAMAVGROUP}" ]; then
|
|
CLAMAVGROUP=clamav
|
|
fi
|
|
|
|
CLAMRUN=/var/run/clamav
|
|
CLAMLOG=/var/log/clamav
|
|
|
|
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}\"."
|
|
else
|
|
echo "===> Adding group \"${CLAMAVGROUP}\" failed..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! pw usershow "${CLAMAVUSER}" 2>/dev/null 1>&2; then
|
|
if pw useradd ${CLAMAVUSER} -g ${CLAMAVGROUP} -h - \
|
|
-s "/usr/sbin/nologin" -d "/nonexistent" \
|
|
-c "Clam Antivirus"; \
|
|
then
|
|
echo "===> Added user \"${CLAMAVUSER}\"."
|
|
else
|
|
echo "===> Adding user \"${CLAMAVUSER}\" failed..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "===> Setting permissions..."
|
|
mkdir -p "${CLAMRUN}"
|
|
chown "${CLAMAVUSER}:${CLAMAVGROUP}" "${CLAMRUN}"
|
|
|
|
mkdir -p "${CLAMLOG}"
|
|
chown "${CLAMAVUSER}:${CLAMAVGROUP}" "${CLAMLOG}"
|
|
fi
|
|
|
|
exit 0
|