PREIN
/bin/sh
if [ -n "`/usr/bin/getgid clamav`" ]; then
if [ "`/usr/bin/getgid clamav`" != "43" ]; then
echo "Error: group clamav doesn't have gid=43. Correct this before installing clamav." 1>&2
exit 1
fi
else
echo "Adding group clamav GID=43."
/usr/sbin/groupadd -g 43 -r clamav 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u clamav 2>/dev/null`" ]; then
if [ "`/bin/id -u clamav`" != "43" ]; then
echo "Error: user clamav doesn't have uid=43. Correct this before installing clamav." 1>&2
exit 1
fi
else
echo "Adding user clamav UID=43."
/usr/sbin/useradd \
\
-u 43 \
-r \
-d /tmp \
-s /bin/false \
-c "Clam Anti Virus Checker"\
-g clamav \
\
\
clamav 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;
# FIXME: check this. is it proper after useradd macro?
# TODO: use addusertogroup macro?
if [ -n "`/usr/bin/getgid amavis`" ]; then
echo "Adding clamav to amavis group"
/usr/sbin/usermod -G amavis clamav 1>&2
fi
PREUN
/bin/sh
if [ "$1" = "0" ]; then
{
if [ -f /var/lock/subsys/clamd ]; then
/sbin/service clamd stop 1>&2 || :;
fi }; /sbin/chkconfig --del clamd
fi
POSTIN
/bin/sh
/sbin/chkconfig --add clamd
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/clamd ] && . /etc/sysconfig/clamd
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/clamd ]; then
/sbin/service clamd restart 1>&2 || :;
else
echo 'Run "/sbin/service clamd start" to start Clam Antivirus daemon.'
fi
fi };touch /var/log/freshclam.log
chown clamav:root /var/log/freshclam.log
chmod 640 /var/log/freshclam.log
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh user del clamav
/usr/lib/rpm/user_group.sh group del clamav
fi
Triggers
amavis-ng
/bin/sh
AMAVIS=$(/usr/bin/getgid amavis)
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Adding clamav to amavis group GID=$AMAVIS"
/usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
fi
amavisd-new
/bin/sh
AMAVIS=$(/usr/bin/getgid amavis)
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Adding clamav to amavis group GID=$AMAVIS"
/usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
fi
amavisd
/bin/sh
AMAVIS=$(/usr/bin/getgid amavis)
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Adding clamav to amavis group GID=$AMAVIS"
/usr/sbin/usermod -G amavis clamav 1>&2
fi
clamav <=
0.75.1
/bin/sh
if [ -f /etc/clamav.conf.rpmsave ]; then
echo "Renaming config to new name /etc/clamd.conf"
mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
echo "Changing config location in freshclam config"
/bin/sed -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
fi
clamav <
0.90-0.rc2.0.10
/bin/sh
/bin/cp -f /etc/clamd.conf{,.rpmsave}
/bin/sed -i -e '
s,^LogSyslog$,& yes,
s,^FixStaleSocket$,& yes,
s,^AllowSupplementaryGroups$,& yes,
s,^ClamukoScanOnOpen$,& yes,
s,^ClamukoScanOnClose$,& yes,
s,^ClamukoScanOnExec$,& yes,
s,^LogTime$,& yes,
s,^ScanPE$,& yes,
' /etc/clamd.conf
RPM_SCRIPTVERBOSITY=5
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
if [ -x /usr/bin/banner.sh ]; then
CMD="/usr/bin/banner.sh --stderr $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m clamav-0.90"
else
CMD="cat >&2"
fi
eval $CMD <&2 || :;
fi
fi };