[blfs-support] Installing ClamAV/clamtk

Paul Rogers paulgrogers at fastmail.fm
Thu Oct 15 10:37:08 PDT 2015


I can report basic installation on my BLFS-7.2 system with xfce.

ClamAV-0.98.7 was essentially installed as follows:

groupadd -g 60 clamav
useradd -g clamav -u 60 -s /bin/false -c "Clam AntiVirus" clamav
(./configure --target="$CTARGET" --sysconfdir=/etc --program-prefix="" \
  2>&1 | tee log.conf && exit $PIPESTATUS) &&
(make 2>&1 | tee log.make && exit $PIPESTATUS) &&
(make check 2>&1 | tee log.test && exit $PIPESTATUS) &&
(make install 2>&1 | tee log.inst && exit $PIPESTATUS) &&
touch /var/log/freshclam.log &&
chown clamav:clamav /var/log/freshclam.log &&
mkdir /usr/local/share/clamav &&
chown clamav:clamav /usr/local/share/clamav

clamtk was a bit more problematic.  I chose to use v4.45 because it
has fewer dependencies on Gnome.  Even so it has many perl module 
dependencies.  A few months(?) back I reported on a set of "common"
perl modules I installed, with a dependency order, but clamtk had
some additions, installed as follows:

list="Sub-Uplevel-0.25
Carp-Clan-6.04
Bit-Vector-7.4
Date-Calc-6.4
Digest-MD5-2.54
Locale-gettext-1.07
Encode-2.78
Cairo-1.106
Pango-1.226
Gtk2-1.2496 "
# We're not stopping on errors, log and keep going
rm -f log.run                   # purge log
for mod in $list
do
 echo "==============================================" >>log.run
 echo $mod >>log.run
 echo "==============================================" >>log.run
 tar -xf $mod.tar.gz
 cd $mod                        # counting on file name matching 
 if [ -f Build.PL ]; then
  # chain these four steps together
  (perl Build.PL 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (./Build 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (./Build test 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (./Build install 2>&1 | tee -a ../log.run && exit $PIPESTATUS)
  # break the chain and continue
 elif [ -f Makefile.PL ]; then
  # Similar process
  (perl Makefile.PL 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (make -j $MMPF 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  (make test 2>&1 | tee -a ../log.run && exit $PIPESTATUS) &&
  if [ $mod = Date-Calc-6.4 ]; then
    (make install UNINST=1 2>&1 | tee -a ../log.run && exit $PIPESTATUS)
  else
    (make install 2>&1 | tee -a ../log.run && exit $PIPESTATUS)
  fi
 else
  echo Neither Build.PL not Makefile.PL found.  What to do?
  exit 1
 fi
 cd ..
 rm -rf $mod
done
# Let's do a little reporting.
ok=`grep ".. ok" log.run |wc -l`
skip=`grep ".. skipped" log.run |wc -l`
tt=0
for r in `grep "wallclock" log.run|awk '{print $2}'`
do
 n=${r#Tests=}
 n=${n%,*}
 let tt=tt+n
done
echo "Test files OK       (372)" $ok
echo "Test files skipped   (13)" $skip
echo "Total tests run  (107169)" $tt

clamtk (4.45) itself "required" a patch.  It was calling zenity, but
the author himself noted in the source it was never used, and was
removed in 5.05.  So I removed it to avoid that useless dependency
chain with this "clamtk-4.45-zenity.patch" patch: 

Patcher:        PGR
Date:           10/10/2015

Zenity brings with it a dependencies, which might be acceptable if one 
were to be using Gnome.  But it wasn't necessary and was removed in 
v5.05.  There's no reason to have it here.


--- clamtk.org  2015-10-10 22:48:27.000000000 -0700
+++ clamtk      2015-10-10 22:54:40.000000000 -0700
@@ -35,9 +35,7 @@
 bind_textdomain_codeset( 'clamtk', 'UTF-8' );
 
 # Ensure all the normal directories are created
-ClamTk::Prefs->structure() or do {
-    zenity_error( gettext('Unable to create startup directories!') );
-};
+ClamTk::Prefs->structure(); 
 
 # Ensure the preferences are normalized
 # Create defaults if they do not exist
@@ -51,16 +49,4 @@
 ClamTk::Submit->test_date();
 
 # Launch!
-ClamTk::GUI->start_gui() or do {
-    zenity_error( gettext('Unable to create graphical interface!') );
-    exit(1);
-};
-
-# I should probably just yank this...
-# not sure it's ever been used.
-sub zenity_error {
-    my $text = shift;
-    my @args = ( 'zenity', '--error', '--title', 'ClamTk', '--text' );
-    system( @args, $text );
-    return;
-}
+ClamTk::GUI->start_gui(); 

So then clamtk-4.45 was built as follows:

patch -Np0 -i ../patches/clamtk-4.45-zenity.patch &&
install -o 0 -g 0 -m 775 clamtk /usr/bin &&
mkdir -p /usr/share/doc/clamtk-4.45 &&
install -o 0 -g 0 -m 664 CHANGES DISCLAIMER LICENSE README \
  /usr/share/doc/clamtk-4.45 &&
install -o 0 -g 0 -m 444 images/*  /usr/share/pixmaps &&
install -o 0 -g 0 -m 644 clamtk.1.gz  /usr/man/man1 &&
install -o 0 -g 0 -m 644 clamtk.desktop  /usr/share/applications &&
(cat >/etc/profile.d/perl <<"EOF"
# Give perl a version agnostic site library too.
export PERL5LIB=/usr/lib/perl5/site_perl/
EOF
) &&
mkdir -p /usr/lib/perl5/site_perl/ClamTk &&
install -o 0 -g 0 -m 775 lib/*.pm /usr/lib/perl5/site_perl/ClamTk

There is one glitch I've noted, but I'm not sure it's the most 
important thing to fix right now:  Clamtk::Schedule.pm calls cron 
and BLFS uses fcron.  The way I run, I'm not sure I want clamtk
scheduling freshclam updates anyhow.  It's easy to ignore this.

Then thunar-sendto-clamtk was installed as follows:

mkdir -p /usr/local/share/thunar-sendto-clamtk-0.05 &&
install -o 0 -g 0 -m 644 CHANGES DISCLAIMER LICENSE README \
  /usr/local/share/thunar-sendto-clamtk-0.05 &&
install -o 0 -g 0 -m 644 thunar-sendto-clamtk.1.gz /usr/share/man/man1
&&
install -o 0 -g 0 -m 644 thunar-sendto-clamtk.desktop \
  /usr/local/share/Thunar/sendto 

So, there it is, basic functionality.  Granted ClamAV isn't a very
good scanner in comparison to other commercial products, but it's
better than nothing IMO--if one realizes its limitations and doesn't
become complacent (and I don't expect us here to do that).


-- Paul Rogers
paulgrogers at fastmail.fm
Rogers' Second Law: "Everything you do communicates."
(I do not personally endorse any additions after this line. TANSTAAFL
:-)

  	

-- 
http://www.fastmail.com - Same, same, but different...



More information about the blfs-support mailing list