# HG changeset patch # User Eric Joseph-Alexandre # Date 1330565698 -3600 # Node ID af696f5ac1e7c08fb3aa4bf465568a25af52b579 # Parent d6d8fe5ff515e0cd41bed5902ba60cf55826fdd4 clamav: improve package diff -r d6d8fe5ff515 -r af696f5ac1e7 clamav/receipt --- a/clamav/receipt Wed Feb 29 16:29:20 2012 -0800 +++ b/clamav/receipt Thu Mar 01 02:34:58 2012 +0100 @@ -23,27 +23,41 @@ ./configure \ --sysconfdir=/etc/clamav \ --with-iconv=no \ - $CONFIGURE_ARGS && - make && - make DESTDIR=$DESTDIR install + $CONFIGURE_ARGS && make && make install } # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d - cp -a $_pkg/usr/bin $fs/usr - cp -a $_pkg/usr/sbin $fs/usr - cp -a $_pkg/etc $fs + mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d \ + $fs/var/log/clamav $fs/var/run/clamav + cp -a $install/usr/bin $fs/usr + cp -a $install/usr/sbin $fs/usr + cp -a $install/etc $fs # Copy only shared lib (.so) - cp -a $_pkg/usr/lib/*.so* $fs/usr/lib - cp -a $_pkg/usr/share/clamav $fs/usr/share + cp -a $install/usr/lib/*.so* $fs/usr/lib + cp -a $install/usr/share/clamav $fs/usr/share # Copy daemon from /$stuff cp $stuff/daemon-clamd $fs/etc/init.d/clamd + + # Customize config + sed -i -e "s/^Example/#Example/" \ + -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \ + -e "s|^#PidFile.*|PidFile /var/run/clamav/clamd.pid|" \ + -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /var/run/clamav/clamd.ctl|" \ + $fs/etc/clamav/clamd.conf + } post_install() { + + local user + local group + + user=clamav + group=clamav + echo "Processing post-install commands..." # Enable freshclam update @@ -52,34 +66,21 @@ sed -i 's/^Example/#Example/' freshclam.conf status - # Enable clamd configuration - echo -n "Enabling clamd daemon..." - cd $1/etc/clamav - sed -i 's/^Example/#Example/; s/^#PidFile/PidFile/' clamd.conf - status - - # Enable local socket - echo -n "Enabling local socket..." - cd $1/etc/clamav - sed -i 's/^#LocalSocket /LocalSocket /' clamd.conf - status - # adduser clamav if needed - if ! grep -q clamav $1/etc/passwd; then - echo -n "Adding user clamav..." - chroot $1/ adduser -s /bin/false -H -D -u 64 clamav - status - fi - - # addgroup clamav if needed - if ! grep -q clamav $1/etc/group; then - echo -n "Adding group clamav..." - chroot $1/ addgroup -g 64 clamav + if ! grep -q "${user}:" $1/etc/passwd; then + echo -n "Adding user/group $user..." + chroot $1/ addgroup -S $group + chroot $1/ adduser -s /bin/false -S -D -H -G $group $user status fi # Enable daily.cvd updates (sometimes needed for new version) - chown -R clamav:clamav $1/usr/share/clamav + chown -R ${user}:${group} $1/usr/share/clamav + + # Fix perms + chroot $1/ chown -R ${user}.${group} /var/log/clamav \ + /var/run/clamav + } # Del user clamav when pkg is removed. diff -r d6d8fe5ff515 -r af696f5ac1e7 clamav/stuff/daemon-clamd --- a/clamav/stuff/daemon-clamd Wed Feb 29 16:29:20 2012 -0800 +++ b/clamav/stuff/daemon-clamd Thu Mar 01 02:34:58 2012 +0100 @@ -12,7 +12,7 @@ DESC="clamav daemon" DAEMON=/usr/sbin/clamd OPTIONS=$CLAMD_OPTIONS -PIDFILE=/var/run/clamd.pid +PIDFILE=/var/run/clamav/clamd.pid case "$1" in start)