configuration

Skip Navigation

Hierarchical Navigation

Previous and Next Navigation

Abstract

In this chapter, we explain configuration of clamav-update. First, we show lineup of configuration files. Next, explain configuration by install.sh At last, We show reference of configuration.

List of configuration files

clamav-update use follow configuration files.

list of configuration files
path name role install or not
${Prefix}/etc/clamav-update.conf for updating ClamAV Install
${Prefix}/etc/clamav-update-update.conf for updating clamav-update itself. Don't edit this file. This file will be overwrite when clamav-update is updated Install
/etc/clamav-update-update.conf for updating clamav-update itself. This files are System wide customization. Install (In some case, not install)
~/.clamav-update-update.conf for updating clamav-update itself. This files are Personal use customization. Not install
Any Others for updating Other software. Not install

where ${Prefix} is the root directory of clamav-update. If you install clamav-update by install.command, ${Prefix} is /usr/local/clamXav. If you install it by install.sh, ${Prefix} is the value specified when you install clamav-update by prefix options of install.sh. If you don't use prefix option, ${Prefix} is /usr/local.

configuration by install.sh/install.command

install.sh obey its options and parameters to make ${Prefix}/clamav-update.conf and /etc/clamav-update-update.conf. Here, we explain how to change configuration by options and parameters by install.sh. it write follow lines in configuration file, but it also add some commented out sentences. They are omitted in this explanation.

configuration In ${Prefix}/clamav-update.conf

$Setting{environment}->{PATH}, commands search path for clamav-update, is:
if you install clamav-update by install.command
or by install.sh with --clamav-prefix=/usr/local/clamXav option
'/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/clamXav/bin'
if you install it by install.sh with --clamav-prefix=/ option
or with --clamav-prefix=/usr option
'/bin:/sbin:/usr/bin:/usr/sbin'
if you install it with --clamav-prefix=DIR option
'/bin:/sbin:/usr/bin:/usr/sbin:DIR/bin'
$Setting{option}->{src}, nearest mirror for clamav, is
If you install it without --clamav-dowmload-from options, default is used,
'http://jaist.dl.sourceforge.net/sourceforge/clamav'
Or if you specified number N to select ClamAV mirror server when you install it by install.command
relevant mirror server's URL. See detail of$Setting{option}->{src} .
Or if you install it by install.sh with --clamav-dowmload-from=URL option
'URL'
$Setting{phase}->{specifier}
if you install clamav-update without --clamdoption
and if you install it without --freshclamoption
installing byinstall.command
or if you install it by install.sh with --clamav-prefix=/usr/local/clamXavoption
default value is used.
and with --clamav-prefix option
or with --clamav-prefix=/usr/local option
\&PhaseSpecifier4General
and with --clamav-prefix=DIR option
sub {
    PhaseSpecifier4General();

    \$Phase{build}->{method} = [
        ['./configure', "--prefix=DIR"],
        [qw(make)],
    ];

    # return success
    1;
}
Or with --freshclam option

It require --freshclam-restart=COMMANDoption to restart freshclam daemon. If no --freshclam-restart=COMMAND, COMMAND is treated as [qw(/etc/rc.d/init.d/freshclam restart)]. In case of installing by install.command, COMMAND is treated as [qw(/Library/StartupItems/FreshclamDaemon/FreshclamDaemon restart)].

if you install it by install.command
Or with --clamav-prefix=/usr/local/clamXav option specified
sub {
    PhaseSpecifier4ClamAV4ClamXav();

    push @{\$Phase{install}->{method}}, (
        [qw(chown root /usr/local/clamXav/bin/freshclam)],
        [qw(chmod u-s /usr/local/clamXav/bin/freshclam)],
        COMMAND,
    );

    1;
}
and with --clamav-prefix option
or with --clamav-prefix=/usr/local option
sub {
    PhaseSpecifier4General();

    push @{\$Phase{install}->{method}}, (
        COMMAND,
    );

    1;
}
and with --clamav-prefix=DIR option
sub {
    PhaseSpecifier4General();

    push @{\$Phase{install}->{method}}, (
        COMMAND,
    );

    \$Phase{build}->{method} = [
        ['./configure', "--prefix=DIR"],
        [qw(make)],
    ];

    1;
}
If you install clamav-update by install.sh by --clamd option

It require --clamd-restart=CLAMD_COMMAND option. If no --clamd-restart=CLAMD_COMMAND option, CLAMD_COMMAND value is treated as [qw(/etc/rc.d/init.d/clamd restart)] . In case of installing by install.command CLAMD_COMMAND is treated as [qw(/Library/StartupItems/ClamAntiVirusDaemon/ClamAntiVirusDaemon restart)].

and without --freshclam option
and by install.command
or with --clamav-prefix=/usr/local/clamXav option
sub {
    PhaseSpecifier4ClamAV4ClamXav();

    push @{\$Phase{install}->{method}}, (
        CLAMD_COMMAND,
    );

    1;
}
and without --clamav-prefix option
or with --clamav-prefix=/usr/local option
sub {
    PhaseSpecifier4General();

    push @{\$Phase{install}->{method}}, (
        CLAMD_COMMAND,
    );

    1;
}
and with --clamav-prefix=DIR option
sub {
    PhaseSpecifier4General();

    push @{\$Phase{install}->{method}}, (
        CLAMD_COMMAND,
    );

    \$Phase{build}->{method} = [
        ['./configure', "--prefix=DIR"],
        [qw(make)],
    ];

    1;
}
and with --freshclam option

It require --freshclam-restart=FRESHCLAM_COMMAND option. If no --freshclam-restart=FRESHCLAM_COMMAND option specified, The value of FRESHCLAM_COMMAND is treated as [qw(/etc/rc.d/init.d/freshclam restart)] . In case of installing by install.command, The value of FRESHCLAM_COMMAND is treated as [qw(/Library/StartupItems/FreshclamDaemon/FreshclamDaemon restart)].

and by install.command
or with --clamav-prefix=/usr/local/clamXav option
sub {
    PhaseSpecifier4ClamAV4ClamXav();

    push @{\$Phase{install}->{method}}, (
        CLAMD_COMMAND,
    );

    push @{\$Phase{install}->{method}}, (
        [qw(chown root /usr/local/clamXav/bin/freshclam)],
        [qw(chmod u-s /usr/local/clamXav/bin/freshclam)],
        FRESHCLAM_COMMAND,
    );

    1;
}
and with --clamav-prefix option
or with --clamav-prefix=/usr/local option
sub {
    PhaseSpecifier4General();

    push @{\$Phase{install}->{method}}, (
        CLAMD_COMMAND,
    );

    push @{\$Phase{install}->{method}}, (
        FRESHCLAM_COMMAND,
    );

    1;
}
and with --clamav-prefix=DIR option specified
sub {
    PhaseSpecifier4General();

    push @{\$Phase{install}->{method}}, (
        CLAMD_COMMAND,
    );

    push @{\$Phase{install}->{method}}, (
        FRESHCLAM_COMMAND,
    );

    \$Phase{build}->{method} = [
        ['./configure', "--prefix=DIR"],
        [qw(make)],
    ];

    1;
}

configuration in /etc/clamav-update-update.conf

In follow 3 term, if no configurations, /etc/clamav-update-update.conf is not installed

$Setting{environment}->{PATH}
If you install clamav-update with --prefix=/usr/local/clamXav option
or by install.command
No configuration, the value of the PATH is read from /usr/local/clamXav/etc/clamav-update-update.conf.
If you install it with --prefix=/usr/ option
the value of PATH is '/bin:/sbin:/usr/bin:/usr/sbin'
Or with --prefix=DIR option
the value of PATH is '/bin:/sbin:/usr/bin:/usr/sbin:DIR'
$Setting{option}->{src}
If you install it with --download-from=http://osdn.dl.sourceforge.jp/clamav-update option
No configuration. the values are read from /usr/local/clamXav/etc/clamav-update-update.conf.
Or with --download-from=URL option
'URL'
$Setting{phase}->{specifier}
If you install it by install.sh with --prefix=/usr/local/clamXav option
Or by install.command
No configuration. The values are read from /usr/local/clamXav/etc/clamav-update-update.conf.
If you install it with --prefix=/usr/local option
\&PhaseSpecifier4ClamavUpdate
Or with --prefix=DIR option
sub {
    PhaseSpecifier4ClamAV4ClamXav();

    \$Phase{install}->{method} = [
        [qw(install -bp -o root -g root -m 0755 clamav-update.pl),
            'DIR/bin/clamav-update.pl'
        )],
        [qw(install -bp -o root -g root -m 0664 clamav-update-update.conf),
            'DIR/etc/clamav-update-update.conf'
        )],
    ];

    1;
}

Reference of Configuration

skip contents of directive

about logging

directive

$Setting{logging}

explanation

Category of handling clamav-update's logging. This is only category, so $Setting{logging} has no value.

saving log

directive

$Setting{logging}->{setlogsock}

explanation

It specify logging methods. you can select GLOB or setlogsock function. GLOB is a GLOB in Perl. The other is setlogsock function in the Sys::Syslog module of Perl.

GLOB

You can specify \*STDOUT and \*STDERR . They are standard out and standard error respectively.

Using GLOB, you can specify any file as log file. for example.

open MY_LOG_FH, '>> /var/log/clamav-update.log' or die;
$Setting{logging}->{setlogsock} = \*MY_LOG_FH;
Syslog

all value except GLOB is treated as Syslog. In this case, this value is passed to setlogsock function of Sys::Syslog module. Effectiveness of the values are depends on your system / version of installed Sys::Syslog module. In my manual of Sys::Syslog, they can accept follow values:

'unix'

Connect to syslog with the UNIX domain socket then output. When using syslog of the local host, in many cases this is effective.

['stream', 'FILE_PATH']

specify FILE_PATH as log file. Using this form, specify Reference to array in Perl.

It's NOT effective on Mac OS X 10.4.8.

'inet'

Connect to syslog with the INET socket then output by tcp and udp. First, clamav-update try to connect by 'tcp' described follow lines. If failed it, try by 'udp'.

'tcp'

Connect to syslog on the host named syslog or syslogng host with tcp socket then output.

'udp'

Connect to syslog on the host named syslog or syslogng host with udp socket then output.

'console'

output to console.

default value

\*STDERR

log level

directive

$Setting{logging}->{setlogmask}

explanation

specify log level to output. clamav-update output in more higher level. If you use syslog, note that syslog's configuration may limit log level.

following values are available.

'emerg'

Emergency level: output when panic error is happened.

'alert'

Alert level: output when an error that administrator should manage quickly is happened.

'crit'

Critical level: output when an critical error is happened.

'err'

Error level: output when any error is happened.

'warning'

Warning level: output when any error may be happened.

'notice'

notice level: output if administrator may need to manage

'info'

info level: output infomation.

'debug'

debug level: for maintenance or debugging

default value

'warning'

about syslog

directive

$Setting{logging}->{openlog}

explanation

Category of modifying clamav-update's logging. It's effective if $Setting{logging}->{setlogsock} is NOT GLOB. It specify "how" to log in syslog. This is only category, so $Setting{logging}->{openlog} has no value.

identification string
directive

$Setting{logging}->{openlog}->{ident}

explanation

specify string added each messages in log as identifier. Generally any other program may log message in syslog . So identification string is needed.

default value

'clamav-update'

option
directive

$Setting{logging}->{openlog}->{logopt}

explanation

specify several syslog output options with Perl reference to array form. Following elements of array are available.

cons

When clamav-update cannot pass the message to syslogd, write it in "/dev/console".

ndelay

No Delay. clamav-update immediately connect to syslogd if it specified.

perror

Use syslog and print standard error.

In my Manual of Sys::Syslog , this is not documented. But this described in C Language interface manual of syslog .

pid

add process ID to each message. It is useful if 2 or more clamav-update.pl are running at the same time.

nowait

In my manual of Sys::Syslog, only this name is described. Reading source code of Sys::Syslog, it is not to wait and do next operation before console output finishing, but actually it seems not used.

you can connect these elements to make Perl reference to array. For example, ['pid', 'cons'] or [qw(pid cons)]

default values

[]

facility
directive

$Setting{logging}->{openlog}->{facility}

explanation

specify types of messages. following value is available.

'auth'

for authentication system, like a login, su or getty

'authpriv'

similar to 'auth' except outputting to write inhibit file.

'console'

output to /dev/console by using kernel's output.

'cron'

for cron daemon. like cron

'daemon'

for system daemon, like a routed. It does not mean that output of other specialized daemon specify this implicitly.

'ftp'

for file transfer protocol daemon , like a ftpd or tftpd.

'kern'

for kernel. It can not use for user process.

'lpr'

for line printer spool system, like a lpr, lpc or lpd

'mail'

for mail system.

'news'

for network news system.

'security'

for security subsystem, like a ipfw

'syslog'

syslogd use internally.

'user'

for arbitrary user process

'uucp'

for UUCP system.

'local0'
'local1'
'local2'
'local3'
'local4'
'local5'
'local6'
'local7'

use by your system's own way. default of ClamAV is 'local6'.

default value

'local6'

environment variables

directive

$Setting{environment}

explanation

Category of configuration of environment variables. This is only category so $Setting{environment} has no value. If your need, arbitrary environment can be set by $Setting{environment}->{Name of Environment Variables} = 'Its Value'; . It may be useful for PATH, http_proxy or ftp_proxy.

PATH

directive

$Setting{environment}->{PATH}

explanation

Specify command search path. This value is important for security. Because commands described by relative path are searched from directory list of environment variable PATH. If clamav-update has contaminated environment variable PATH, perhaps some evil crack command are executed.

default value

'/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/clamXav/bin'

about version

directive

$Setting{version}

explanation

Category of getting version of clamav and comparison. This is only category, so $Setting{version} has no values.

getting latest version

directive

$Setting{version}->{latest}

explanation

Category of getting latest version of clamav. This is only category, so $Setting{version}->{latest} has no values.

command to get latest version
directive

$Setting{version}->{latest}->{command}

explanation

specify a command to get latest version info of clamav. 3 forms are available: strings, Perl reference to arrays and Perl reference to function are supported.

If the command is given by strings and Perl reference to array form, Perl's open function receive it, then its standard out by pipe is treated as version info which include version strings. If the command is given by Perl reference to function, its returned value is treated as version info.

those version info is not need to be version strings. clamav-update can version strings from version info by the regular explanation specified by $Setting{version}->{latest}->{regexp}.

default value

[qw(host -t txt current.cvd.clamav.net)]

regular explanation to get latest version
directive

$Setting{version}->{latest}->{regexp}

explanation

a Perl regular expression to get latest version strings from version info that got by command specified by $Setting{version}->{latest}->{command} . Pattern matching string to $1 is treated as version string.

default value

qr/"(\d+(?:\.\d+)*):\d+:\d+:\d+:[^"]*"\s*$/

getting current version

directive

$Setting{version}->{current}

explanation

Category of getting current version of clamav. This is only category, so $Setting{version}->{current} has no values.

command to get current version
directive

$Setting{version}->{current}->{command}

explanation

specify a command to get current version info of clamav. 3 forms are available: strings, Perl reference to arrays, and Perl reference to function are supported.

If the command is given by strings and Perl reference to array form, Perl's open function receive it, then its standard out by pipe is treated as version info which include version strings. If the command is given by Perl reference to function, its returned value is treated as version info.

those version info is not need to be the same as version strings. clamav-update can get version strings from version info by the regular explanation specified by $Setting{version}->{current}->{regexp}.

default value

[qw(clamav-config --version)]

regular expression to get current version
directive

$Setting{version}->{current}->{regexp}

explanation

a Perl regular expression to get current version strings from version info that got by command specified by $Setting{version}->{current}->{command} . Pattern matching string to $1 is treated as version string.

default value

qr/^(\d+(?:\.\d+)*)\s*$/

version comparison function

directive

$Setting{version}->{compare}

explanation

specify Perl reference to function so that compare latest version string and current version string.

This function must has 2 version strings as arguments. and return negative integer if 1st argument is less version and 0 if 1st and 2nd version are the same and positive integer if 1st argument is higher version.

default value
sub {
    my  ($a, $b) = @_;
    my  @a = reverse(split(/\./, $a));
    my  @b = reverse(split(/\./, $b));

    while (0 < scalar(@a) and 0 < scalar(@b)) {
        $a = pop @a;
        $b = pop @b;
        return -1   if ($a < $b);
        return  1   if ($a > $b);
    }
    return  1   if (0 < scalar(@a));
    return -1   if (0 < scalar(@b));
    return  0;
}

options

directive

$Setting{option}

explanation

Category of clamav-update's options that you can change value by command line. This is only category, so $Setting{option} has no values. All directives in this category are treat as default value and those are used if no relevant options are given.

All directives in this category -- Undocumented directives and your handmade directives -- are also changeable temporary by command line. This function is only available in clamav-update version 2.2 or higher.

URL of download from

directive

$Setting{option}->{src}

explanation

Specify url URL of mirror/official site that some software downloading from.

For downloading ClamAV, following 15 values are available.

'http://jaist.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Asia, Japan, Ishikawa
'http://nchc.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Asia, Taiwan, Tainan
'http://optusnet.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Australia, Sydney
'http://surfnet.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, Holland, Amsterdam
'http://belnet.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, Belgium, Brussels
'http://heanet.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, Ireland, Dublin
'http://mesh.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, Germany, Dusseldorf
'http://kent.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, United Kingdom, Kent
'http://switch.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, Swiss, Lausanne
'http://ovh.dl.sourceforge.net/sourceforge/clamav'
Mirror server in Europe, France, Paris
'http://superb-east.dl.sourceforge.net/sourceforge/clamav'
Mirror server in North America, Virginia, McLain
'http://umn.dl.sourceforge.net/sourceforge/clamav'
Mirror server in North America, Minnesota, Minneapolis
'http://easynews.dl.sourceforge.net/sourceforge/clamav'
Mirror server in North America, Arizona, Phoenix
'http://superb-west.dl.sourceforge.net/sourceforge/clamav'
Mirror server in North America, Washington, Seattle
'http://ufpr.dl.sourceforge.net/sourceforge/clamav'
Mirror server in South America, Brazil, Curitiba

For clamav-update, following 3 URLs are available.

'http://osdn.dl.sourceforge.jp/clamav-update'
Mirror server in Tokyo,Japan managed by OSDN. We recommend this URL for user lives outside of Japan too.
'http://keihanna.dl.sourceforge.jp/clamav-update'
Mirror server in Kyoto, Japan managed by Kansai Science City Internet Comunity
'http://qgpop.dl.sourceforge.jp/clamav-update'
Mirror server in Fukuoka, Japan managed byKyushu GigaPOP Project

Those values are not directly used by clamav-update.pl . Those are used only when it download archives. See detail in %Phase.

default value

'http://jaist.dl.sourceforge.net/sourceforge/clamav'

directory of downloading to

directive

$Setting{option}->{dst}

explanation

A temporary directory saving downloaded archive and being used as working directory. Default value is several alphanumeric string under system temporary directory. clamav-update make this directory before it download archive, and remove after it finish.

Those values are not directly used by clamav-update.pl . Those are used only when it download archives. See detail in %Phase.

default value

tempdir(CLEANUP => 1)

Package name

directive

$Setting{option}->{name}

explanation

Specify a name of package

Those values are not directly used by clamav-update.pl . Those are used only when it download archives. See detail in %Phase.

default value

clamav

archive's suffix

directive

$Setting{option}->{ext}

explanation

Specify suffix of the archive

Those values are not directly used by clamav-update.pl . Those are used only when it download archives. See detail in %Phase.

force to install

directive

$Setting{option}->{force}

explanation

Specify to force to install if this value is non-nil for Perl. In this case, local version strings are treats as empty string. We assume that $Setting{version}->{compare} return negative integer.

Perl treat Empty string "", integer 0, real number 0.0, undefined value(undef) and array with size 0 as nil. Others are treated as no-nil.

Default value

0

update limit

directive

$Setting{option}->{limit}

explanation

Category for update limitation by version. This is category, so $Setting{option}->{limit} don't have value.

Several abilities and configurations in this category are available for clamav-update version 2.1 or higher

version limit
directive

$Setting{option}->{limit}->{version}

explanation

This is the limit lowest version number for clamav-update. clamav-update don't update software if its latest version is equal to limit lowest version or higher version.

If you specify undef , ignore limitation for update software.

Default value

undef

update limit action
directive

$Setting{option}->{limit}->{action}

explanation

Specify action when clamav-update stop updating by version limit. you can specify Perl key of %Phase. Practically you would specify action by $Setting{phase}->{specifier}. It is useful to send notice e-mail or something to do notice administrator.

If you specify undef, clamav-update don't any special things. But clamav-update put log with warning level. This behavior is value independent.

Default value

undef

phase

directive

$Setting{phase}

explanation

If a version of the software in mirror is newer than local one, in other words, comparison function defined by ($Setting{version}->{compare} return negative integer, clamav-update execute several commands. We call it "phase". This is category for phase. so $Setting{phase} don't have any value.

sequence

directive

$Setting{phase}->{sequence}

explanation

Specify phase names and its order to execute with Perl reference to array format.

Phase name is a key of Perl hash %Phase. You had better use strings to output on some log files.

Default value

[qw(download extract build install)]

definition function

directive

$Setting{phase}->{specifier}

explanation

Specify definition of details of each phase as Perl reference to function. This functions are executed with no arguments after version check. If one of those function return nil, it means failure, clamav-update.pl stop all execution.

This function must make several Perl's hash %Phase completely. We explain a detail of %Phase in later.

follow built-in phase definition function is available.

PhaseSpecifier4General

We assume that installing the software distributed by source archives for UNIX-like OS has follow steps.

phase names
4 phases : download, extract, build, install
distribution URL
URL of downloading/package name-latest version strings.suffix of archive
archive format
gzip-compressed tar archive
A new directory name created by uncompressed the archive
Package_name-latest_version_string
How to build
Execute follow commands in the new directory created by uncompressed the archive.
  1. ./configure
  2. make
How to install
Execute follow commands in the new directory created by uncompressed the archive.
  1. make install
Other
We assume that curl, and tar commands (with z option) are available on your system.
PhaseSpecifier4ClamAV4ClamXav

Phase definition of clamav for ClamXav (Mac OS X). We explain only difference this and PhaseSpecifier4General.

How to build
Execute follow commands in the new directory created by uncompressed the archive.
  1. ./configure --prefix=/usr/local/clamXav
  2. make
how to install
Execute follow commands in the new directory created by uncompressed the archive.
  1. make install
  2. install -d -o root -g admin -m 0775 /usr/local/clamXav
  3. chown -R root:admin /usr/local/clamXav/etc
  4. find /usr/local/clamXav/etc -type d -exec chmod 0775 {} \;
  5. find /usr/local/clamXav/etc -type f -exec chmod 0664 {} \;
  6. chown -R root:admin /usr/local/clamXav/bin
  7. chmod -R 0755 /usr/local/clamXav/bin
  8. chown clamav /usr/local/clamXav/bin/freshclam
  9. chmod u+s /usr/local/clamXav/bin/freshclam
  10. chown -R clamav:clamav /usr/local/clamXav/share/clamav
  11. find /usr/local/clamXav/share/clamav -type d -exec chmod 0775 {} \;
  12. find /usr/local/clamXav/share/clamav -type f -exec chmod 0664 {} \;
  13. touch /usr/local/clamXav/share/clamav/freshclam.log
  14. chmod 0664 /usr/local/clamXav/share/clamav/freshclam.log
This is based on ClamAV's permission modification described in ClamXav official cite"ClamXav - Documentation - Build Your Own" and has been added several improvements. In official one, they assume that there are only files, no directories, under /usr/local/clamXav/etc/, /usr/local/clamXav/bin/, /usr/local/clamXav/share/clamav/. In this case, directories under /usr/local/clamXav/etc/, /usr/local/clamXav/bin/ or /usr/local/cla,mXav/share/clamav/ are countable.
PhaseSpecifier4PkgOnDmg

We assume that installing the software distribution by disk imaged pkg archive for Mac OS X has follow steps.

phase names
4 phases : download, attach, install, detach
Download URL
URL of downloading/package name-latest version strings.suffix of archive
Archive format
Disk image format (suffix:dmg). When you mount that disk image, it turn into new pkg directory (it treats as file by Finder) package name-version string .
Contents of volume
At top directory in attached volume, a directory, which has name as package name-version string.pkg exist.
Other
We assume that hdiutil, installer are available on your system.
PhaseSpecifier4ClamavUpdate4ClamXav

Phase for clamav-update for ClamXav. Following points are only different from this and PhaseSpecifier4General.

Phases name
3 phases : download, extract, install
Download URL
URL of downloading/release ID/package name-latest version strings.suffix of archive
How to install
Execute following commands in the new directory created by uncompressed the archive.
  1. install -Cbp -o root -g admin -m 0755 clamav-update.pl /usr/local/clamXav/bin/clamav-update.pl
  2. install -Cbp -o root -g admin -m 0664 clamav-update-update.conf /usr/local/clamXav/etc/clamav-update-update.conf
PhaseSpecifier4ClamavUpdate

phase definition of clamav-update in case of installing by Install script ./instal.sh WITHOUT --prefix option or WITH -prefix=/usr/local option. This is similar to case of PhaseSpecifier4ClamavUpdate4ClamXav. But following points are different.

How to install
Execute following commands in the new directory created by uncompressed the archive.
  1. install -bp -o root -g root -m 0755 clamav-update.pl /usr/local/bin/clamav-update.pl
  2. install -bp -o root -g root -m 0664 clamav-update-update.conf /usr/local/etc/clamav-update-update.conf

NOTE: Some Perl variables are already defined, and you can use some Perl variables: Latest Version String, Current Version String variables. And also you can specify Perl's hash %Setting. Additionally Perl functions defined in clamav-update.pl are available. Following variables may be useful.

$LatestVersion
Latest Version String of the software (version of the software in mirror site)
$CurrentVersion
Current Version Strings of installed software (local)
Log $level, $format, @args
Output log. Perl Variable$level is able to specified in $Setting{logging}->{setlogmask}. $format is a format string of Perl function printf. @args are arguments of that function.
DoCommand $commandLine
DoCommand $command, @args
system function with log output.
ReadCommandResult $commandLine
ReadCommandResult $command, @args
It is similar to DoCommand but this return value that standard output strings of that system function. If it fails, this returns undef.

If you want to see some samples of Phase definition functions in order to write them, we recommend you to read built-in functions written in clamav-update.pl.

default value

\&PhaseSpecifier4ClamAV4ClamXav

Phase definition

Hash of Perl %Phase defines phases as follow:

(
    phase name  => {
        workdir     => /path/to/working/directory,
        method      => [
            command,
            ...
        ],
        rollback    => [
            command,
            ...
        ],
    },
    ...
)

We explain about phase name, specifying working directory and commands

phase name

phase names, being a Perl key of Hash %Phase, are listed in $Setting{phase}->{sequence} and/or specified in $Setting{opion}->{limit}->{action}. Invalid variables are ignored. They have no effect on others, so you can change them by Perl function specified in $Setting{phase}->{specifier}. But we recommend another variables for simplicity and future extensions.

We recommend ASCII strings as pahse names. Because it's used as strings for log messages. And if those are Perl's identifiers, you can write as $Phase{phase name}. Not $Phase{'phase name'}

Each phase name's value is corresponding to Perl reference to hash.

specifying working directory

You can specify working directory by undef, strings and reference to function.

undef means that not specifying. if you specify undef, you must specify commands in that phase are executed with assumption that current directory is a system/execution dependent.

If you specify strings, those strings must be exist directory. And that directory is current directory when those command are executed. If strings is Null, in other word empty string, or not exist one, clamav-update detect an error and that phase is treated as failed.

If you specify reference to function, strings that the function without arguments return must be exist directory. And that directory is current directory when those commands are executed, If that function return undef or null string or un-exist directory clamav-update detect an error and that phase of treated as failed. Those command values are evaluated when that executed, so variables and functions specified/defined in $Setting{phase}->{specifier}, and defined variables in previous phase are available.

You'd better use absolute path not relative for strings or return value of specified reference of function. Generally you cannot assume current directory when clamav-update.pl is executed. It is NOT secure. If you use relative path, those command in some phase may be different from what you mean. Perhaps, some attacker put on evil one. ( It maybe be malicious)

commands

2 kind of command array are available. Those are method and rollback. clamav-update execute commands specified bymethod for each phase. If an error is detected in some phase, it execute commands specified by rollback. So commands of rollback are not executed usually. Commands are done by in order by specified. If a command in array is failed , the command array is treated as an error.

You can specified strings, reference to array, and to function as a command.

Strings and references to array are treated as arguments of Perl system function, clamav-update execute system function. References to function are executed without arguments. In system function case, if that status is not 0, then that command is treated as error. In the other, that function return not true, that command is treats as error.

Those command values are evaluated when that executed, so variables and functions specified/defined in $Setting{phase}->{specifier}, and defined variables in previous phase are available.