-#!/bin/sh
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-groupadd -f clamav
-hv_useradd -g clamav -s /bin/false -c Clam-AntiVirus clamav
-
-cd ${LFS_TMP}/${1}
-SENDMAIL="/usr/sbin/sendmail" ./configure \
- --prefix=/usr \
- --sysconfdir=/etc \
- --with-dbdir=/srv/clamav \
- --enable-milter
-make
-make install
-touch /var/log/clamd.log
-chmod 600 /var/log/clamd.log
-chown clamav /var/log/clamd.log
-touch /var/log/freshclam.log
-chmod 600 /var/log/freshclam.log
-chown clamav /var/log/freshclam.log
-
-# Addition to /etc/fcron/fcrontab to update virus database
-string_add "Update the Clam AV database every hour" /etc/fcron/fcrontab
-string_add "&mail(false) 0 * * * * /usr/bin/freshclam --quiet" /etc/fcron/fcrontab
-
-# Configuration file
-cat > /etc/clamd.conf << "EOF"
+#!/bin/bash
+
+hvconfig_pre()
+{
+ groupadd -f clamav
+ hv_useradd -g clamav -s /bin/false -c Clam-AntiVirus clamav
+
+ # Is this really necessary?
+ export SENDMAIL="/usr/sbin/sendmail"
+
+ CONFIGURE_OPTS="\
+ ${CONFIGURE_OPTS} \
+ --with-dbdir=/srv/clamav \
+ --enable-milter"
+}
+
+hvconfig_post()
+{
+ unset SENDMAIL
+}
+
+hvbuild_post()
+{
+ install -v -m644 ${SCRDIR}/misc/freshclam /etc/fcron/fcron.d
+
+ touch /var/log/clamd.log
+ chmod 600 /var/log/clamd.log
+ chown clamav /var/log/clamd.log
+ touch /var/log/freshclam.log
+ chmod 600 /var/log/freshclam.log
+ chown clamav /var/log/freshclam.log
+
+ # Configuration file
+ cat > /etc/clamd.conf << "EOF"