wok-current diff clamav/receipt @ rev 11931

clamav: improve package
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Mar 01 02:34:58 2012 +0100 (2012-03-01)
parents d2d3a1cb8911
children 7896f0694ef6
line diff
     1.1 --- a/clamav/receipt	Wed Nov 02 15:36:42 2011 +0000
     1.2 +++ b/clamav/receipt	Thu Mar 01 02:34:58 2012 +0100
     1.3 @@ -23,27 +23,41 @@
     1.4  	./configure \
     1.5  		--sysconfdir=/etc/clamav \
     1.6  		--with-iconv=no \
     1.7 -		$CONFIGURE_ARGS &&
     1.8 -	make &&
     1.9 -	make DESTDIR=$DESTDIR install
    1.10 +		$CONFIGURE_ARGS && make && make install
    1.11  }
    1.12  
    1.13  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.14  genpkg_rules()
    1.15  {
    1.16 -	mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d 
    1.17 -	cp -a $_pkg/usr/bin $fs/usr
    1.18 -	cp -a $_pkg/usr/sbin $fs/usr
    1.19 -	cp -a $_pkg/etc $fs
    1.20 +	mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d \
    1.21 +		$fs/var/log/clamav $fs/var/run/clamav
    1.22 +	cp -a $install/usr/bin $fs/usr
    1.23 +	cp -a $install/usr/sbin $fs/usr
    1.24 +	cp -a $install/etc $fs
    1.25  	# Copy only shared lib (.so)
    1.26 -	cp -a $_pkg/usr/lib/*.so* $fs/usr/lib
    1.27 -	cp -a $_pkg/usr/share/clamav $fs/usr/share
    1.28 +	cp -a $install/usr/lib/*.so* $fs/usr/lib
    1.29 +	cp -a $install/usr/share/clamav $fs/usr/share
    1.30  	# Copy daemon from /$stuff
    1.31  	cp $stuff/daemon-clamd $fs/etc/init.d/clamd
    1.32 +	
    1.33 +	# Customize config
    1.34 +	sed -i -e "s/^Example/#Example/" \
    1.35 +		-e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
    1.36 +		-e "s|^#PidFile.*|PidFile /var/run/clamav/clamd.pid|" \
    1.37 +		-e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /var/run/clamav/clamd.ctl|" \
    1.38 +		$fs/etc/clamav/clamd.conf
    1.39 +		
    1.40  }
    1.41  
    1.42  post_install()
    1.43  {
    1.44 +	
    1.45 +	local user
    1.46 +	local group
    1.47 +	
    1.48 +	user=clamav
    1.49 +	group=clamav
    1.50 +	
    1.51  	echo "Processing post-install commands..."
    1.52  	
    1.53  	# Enable freshclam update
    1.54 @@ -52,34 +66,21 @@
    1.55  	sed -i 's/^Example/#Example/' freshclam.conf 
    1.56  	status
    1.57  
    1.58 -	# Enable clamd configuration
    1.59 -	echo -n "Enabling clamd daemon..."
    1.60 -	cd $1/etc/clamav
    1.61 -	sed -i 's/^Example/#Example/; s/^#PidFile/PidFile/' clamd.conf
    1.62 -	status
    1.63 -
    1.64 -	# Enable local socket
    1.65 -	echo -n "Enabling local socket..."
    1.66 -	cd $1/etc/clamav
    1.67 -	sed -i 's/^#LocalSocket /LocalSocket /' clamd.conf
    1.68 -	status
    1.69 -
    1.70  	# adduser clamav if needed
    1.71 -	if ! grep -q clamav $1/etc/passwd; then
    1.72 -		echo -n "Adding user clamav..."
    1.73 -		chroot $1/ adduser -s /bin/false -H -D -u 64 clamav
    1.74 -		status
    1.75 -	fi
    1.76 -
    1.77 -	# addgroup clamav if needed
    1.78 -	if ! grep -q clamav $1/etc/group; then
    1.79 -		echo -n "Adding group clamav..."
    1.80 -		chroot $1/ addgroup -g 64 clamav 
    1.81 +	if ! grep -q "${user}:" $1/etc/passwd; then
    1.82 +		echo -n "Adding user/group $user..."
    1.83 +		chroot $1/ addgroup -S $group
    1.84 +		chroot $1/ adduser -s /bin/false -S -D -H -G $group $user
    1.85  		status
    1.86  	fi
    1.87  
    1.88  	# Enable daily.cvd updates (sometimes needed for new version)
    1.89 -	chown -R clamav:clamav $1/usr/share/clamav
    1.90 +	chown -R ${user}:${group} $1/usr/share/clamav
    1.91 +	
    1.92 +	# Fix perms
    1.93 +	chroot $1/ chown -R ${user}.${group} /var/log/clamav \
    1.94 +		/var/run/clamav
    1.95 +
    1.96  }
    1.97  
    1.98  # Del user clamav when pkg is removed.