なんだこれは

はてなダイアリーから移転しました。

ClamXavにClamAV自動update機能がプラスできるかも?

ClamXavのsupport forumにて、ClamAVのダウンロードとコンパイルを自動で行うスクリプトが公開されました。そのタイトルはScript to download thelatest engine, compile it and freshen

これに必要なのは開発キット(Xcode ?)とgmpらしいです。gmpftp://ftp.gnu.org/gnu/gmp から落とせるそうで、方法はhttp://www.gnu.org/software/gmp/manual/html_node/Installing-GMP.html#Installing%20GMPにあるそうですが、

./configure
make
make check
make install

らしいですよ。それで肝心のScriptはこれ*1

#!/bin/sh
############################################
## Documentation:
## This script downloads the latest version of clamav and installs
## it compatibly with ClamXav based on work here
## http://www.macosxhints.com/article.php?story=20060409060940665&query=clam
## My example uses a download from the east coast - see
## http://prdownloads.sourceforge.net/clamav/ clamav-0.88.2.tar.gz?download
## for an example of the possible downloads as of version 0.88.2
## note the download urls are not displayed but check the path of the actual download
## most of my comments follow the line of code
## I document for learning as well as documenting purposes
## the next thing this should do I think is hide all the text flying by,
## report success or not
## and be included as a program or plugin to clamXav
## note this only updates the engine. An installation of ClamXav will do other things
## and should be done BEFORE doing this update.
############################################
url=" http://superb-east.dl.sourceforge.net/sourceforge/clamav/clamav-"
# this is a variable which has most of the download url, it's missing the
# version number
# the following line downloads a url as a file in the default location and 
# it will have the latest version in the html of the file downloaded
latest=`curl -O "http://www.clamav.net/stable.php#pagestart" \
; grep "released (" stable.php* | awk '{print $2}' | head -1`
# this line searches the file named stable.php{anything} for "released ("
# and backs up to the version number in this line of text
curl -O $url$latest.tar.gz && \
# this downloads the resulting file name as a file of the same name
printf "The latest version of clamav or %s has been downloaded!\n" $latest && \
tar zxvf clamav-$latest.tar.gz && \
cd clamav-$latest
./configure --prefix=/usr/local/clamXav &&
# this tells the compiler to install the comilation in the clamXav compatible location
make && \
sudo make install && \
# the following lines reset permissions as needed by clamXav as documented at
# http://markallan.co.uk/clamXav/index.php?page=byo
chown -R root /usr/local/clamXav
chgrp -R admin /usr/local/clamXav
chmod -R 666 /usr/local/clamXav/etc/freshclam.conf
chmod u+s /usr/local/clamXav/bin/freshclam
chmod a+wr /usr/local/clamXav/share/clamav/freshclam.log
chown -R clamav /usr/local/clamXav/share/clamav
chgrp -R clamav /usr/local/clamXav/share/clamav
chmod -R g+w /usr/local/clamXav/share/clamav
chmod -R u+w /usr/local/clamXav/share/clamav
printf "Ok I am updating to the latest virus definitions for \
version %s by running freshclam.", $latest && \
/usr/local/clamXav/bin/freshclam && \
# these steps clean up all the stuff downloaded and or created
cd ..
rm -Rf cd clamav-$latest
rm -f clamav-$latest.tar.gz
rm -f stable.php*

fu7mu4、今日は疲れたので試さずに帰ります。

続くっ!!

*1:改行を追加してます