| 64 |
|
|
| 65 |
#### Environment Variables #### |
#### Environment Variables #### |
| 66 |
# $Setting{environment}->{VARNAME} = 'VALUE'; |
# $Setting{environment}->{VARNAME} = 'VALUE'; |
| 67 |
|
# PATH |
| 68 |
|
# for ClamXav user |
| 69 |
#$Setting{environment}->{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/clamXav/bin'; |
#$Setting{environment}->{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/clamXav/bin'; |
| 70 |
|
# for normal ClamAV user |
| 71 |
|
#$Setting{environment}->{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin'; |
| 72 |
|
|
| 73 |
|
|
| 74 |
#### Getting Version Method #### |
#### Getting Version Method #### |
| 75 |
# latest version |
# latest version |
| 76 |
# command to get |
# command to get |
| 77 |
#$Setting{version}->{latest}->{command} = 'host -t txt current.cvd.clamav.net'; |
#$Setting->{version}->{latest}->{command} = [qw( |
| 78 |
|
# host -t txt current.cvd.clamav.net |
| 79 |
|
#)]; |
| 80 |
|
|
| 81 |
# the regular expression that is applied to command output |
# the regular expression that is applied to command output |
| 82 |
#$Setting{version}->{latest}->{regexp} = qr/"(\d+(?:\.\d+)*):\d+:\d+:\d+:[^"]*"\s*$/; |
#$Setting->{version}->{latest}->{regexp} = qr/"(\d+(?:\.\d+)*):\d+:\d+:\d+:[^"]*"\s*$/; |
| 83 |
|
|
| 84 |
# current version |
# current version |
| 85 |
# command to get |
# command to get |
| 86 |
#$Setting{version}->{current}->{command} = 'clamav-config --version'; |
#$Setting->{version}->{current}->{command} = [qw(clamav-config --version)]; |
| 87 |
|
|
| 88 |
# the regular expression that is applied to command output |
# the regular expression that is applied to command output |
| 89 |
#$Setting{version}->{current}->{regexp} = qr/^(\d+(?:\.\d+)*)\s*$/; |
#$Setting->{version}->{current}->{regexp} = qr/^(\d+(?:\.\d+)*)\s*$/; |
| 90 |
|
|
| 91 |
# version number compare method |
# version string compare function |
| 92 |
#$Setting{version}->{compare} = sub { |
#$Setting->{version}->{compare} = sub { |
| 93 |
# my ($a, $b) = @_; |
# my ($a, $b) = @_; |
| 94 |
# my @a = reverse(split(/\./, $a)); |
# my @a = reverse(split(/\./, $a)); |
| 95 |
# my @b = reverse(split(/\./, $b)); |
# my @b = reverse(split(/\./, $b)); |
| 96 |
# |
# |
| 97 |
# while (0 < scalar(@a) and 0 < scalar(@b)) { |
# while (0 < scalar(@a) and 0 < scalar(@b)) { |
| 98 |
# $a = pop @a; |
# $a = pop @a; |
| 99 |
# $b = pop @b; |
# $b = pop @b; |
| 100 |
# return -1 if ($a < $b); |
# return -1 if ($a < $b); |
| 101 |
# return 1 if ($a > $b); |
# return 1 if ($a > $b); |
| 102 |
# } |
# } |
| 103 |
# return 1 if (0 < scalar(@a)); |
# return 1 if (0 < scalar(@a)); |
| 104 |
# return -1 if (0 < scalar(@b)); |
# return -1 if (0 < scalar(@b)); |
| 105 |
# return 0; |
# return 0; |
| 106 |
#}; |
#}; |
| 107 |
|
|
| 108 |
|
|
| 109 |
#### Update Phases Sepcification #### |
#### Options #### |
| 110 |
# phases sequence |
# These settings will be overwrited with command line options. |
|
#$Setting{phase}->{sequence} = [qw(download extract build install postInstall clean)]; |
|
|
|
|
|
# clean phase specification |
|
|
#$Setting{phase}->{clean} = 'clean'; |
|
|
|
|
|
|
|
|
|
|
|
#### Download Phase Specification #### |
|
| 111 |
# download from |
# download from |
| 112 |
# 'http://jaist.dl.sourceforge.net/sourceforge/clamav' - Asia: Ishikawa, Japan |
# 'http://jaist.dl.sourceforge.net/sourceforge/clamav' - Asia: Ishikawa, Japan |
| 113 |
# 'http://nchc.dl.sourceforge.net/sourceforge/clamav' - Asia: Tainan, Taiwan |
# 'http://nchc.dl.sourceforge.net/sourceforge/clamav' - Asia: Tainan, Taiwan |
| 124 |
# 'http://easynews.dl.sourceforge.net/sourceforge/clamav' - North America: Phoenix, AZ |
# 'http://easynews.dl.sourceforge.net/sourceforge/clamav' - North America: Phoenix, AZ |
| 125 |
# 'http://superb-west.dl.sourceforge.net/sourceforge/clamav' - North America: Seattle, Washington |
# 'http://superb-west.dl.sourceforge.net/sourceforge/clamav' - North America: Seattle, Washington |
| 126 |
# 'http://ufpr.dl.sourceforge.net/sourceforge/clamav' - South America: Curitiba, Brazil |
# 'http://ufpr.dl.sourceforge.net/sourceforge/clamav' - South America: Curitiba, Brazil |
| 127 |
#$Setting{download}->{srcBase} = 'http://jaist.dl.sourceforge.net/sourceforge/clamav'; |
$Setting{option}->{src} = 'http://jaist.dl.sourceforge.net/sourceforge/clamav'; |
| 128 |
|
|
| 129 |
# save direcotry |
# download to |
| 130 |
#$Setting{download}->{dstBase} = '/tmp'; |
#$Setting{option}->{dst} = tempdir(CLEANUP => 1); |
| 131 |
|
|
| 132 |
# package name |
# package name (don't change for clamav) |
| 133 |
#$Setting{download}->{name} = 'clamav'; |
#$Setting{option}->{name} = 'clamav'; |
| 134 |
|
|
| 135 |
|
# archive file extention (don't change for clamav) |
| 136 |
|
#$Setting{option}->{ext} = 'tar.gz'; |
| 137 |
|
|
| 138 |
|
# force install |
| 139 |
|
#$Setting{option}->{force} = 0; |
| 140 |
|
|
|
# package file extension |
|
|
#$Setting{download}->{ext} = 'tar.gz'; |
|
|
|
|
|
# common |
|
|
# working directory |
|
|
#$Setting{download}->{workdir} = undef; |
|
|
|
|
|
# phase commands sequence |
|
|
#$Setting{download}->{sequence} = [ |
|
|
# sub { |
|
|
# my ($latestVersion, $currentVersion) = @_; |
|
|
# my $fname = sprintf( |
|
|
# '%s-%s.%s', |
|
|
# $Setting{download}->{name}, |
|
|
# $latestVersion, |
|
|
# $Setting{download}->{ext}, |
|
|
# ); |
|
|
# my $src = sprintf( |
|
|
# '%s/%s', $Setting{download}->{srcBase}, $fname |
|
|
# ); |
|
|
# my $dst = sprintf( |
|
|
# '%s/%s', $Setting{download}->{dstBase}, $fname |
|
|
# ); |
|
|
# |
|
|
# if (-f $dst) { |
|
|
# Log 'notice', 'already exists: %s', $dst; |
|
|
# 1; |
|
|
# } |
|
|
# else { |
|
|
# DoCommand('curl', '--silent', '-o', $dst, $src); |
|
|
# } |
|
|
# }, |
|
|
#]; |
|
|
|
|
|
|
|
|
#### Extract Phase Specification #### |
|
|
# common |
|
|
# working directory |
|
|
#$Setting{extract}->{workdir} = undef; |
|
|
|
|
|
# phase commands sequence |
|
|
#$Setting{extract}->{sequence} = [ |
|
|
# sub { |
|
|
# my ($latestVersion, $currentVersion) = @_; |
|
|
# my @cmd = ( |
|
|
# 'tar', 'xzf', |
|
|
# sprintf( |
|
|
# '%s/%s-%s.%s', |
|
|
# $Setting{download}->{dstBase}, |
|
|
# $Setting{download}->{name}, |
|
|
# $latestVersion, |
|
|
# $Setting{download}->{ext}, |
|
|
# ), |
|
|
# '-C', $Setting{download}->{dstBase} |
|
|
# ); |
|
|
# |
|
|
# DoCommand(@cmd); |
|
|
# }, |
|
|
#]; |
|
|
|
|
|
|
|
|
#### Build Phase Specification #### |
|
|
# common |
|
|
# working directory |
|
|
#$Setting{build}->{workdir} = sub { |
|
|
# my ($latestVersion, $currentVersion) = @_; |
|
|
# |
|
|
# sprintf('%s/%s-%s', |
|
|
# $Setting{download}->{dstBase}, $Setting{download}->{name}, |
|
|
# $latestVersion |
|
|
# ); |
|
|
#}; |
|
| 141 |
|
|
| 142 |
# phase commands sequence |
#### Update Phases Sepcification #### |
| 143 |
#$Setting{build}->{sequence} = [ |
# phase sequence |
| 144 |
# [qw(./configure --prefix=/usr/local/clamXav)], |
#$Setting{phase}->{sequence} = [qw(download extract build install)]; |
| 145 |
# [qw(make)], |
|
| 146 |
#]; |
# custom phase specifier |
| 147 |
|
# for ClamXav user |
| 148 |
|
#$Setting{phase}->{specifier} = sub { |
| 149 |
#### Install Phase Specification #### |
# # use build-in specifier |
| 150 |
# common |
# PhaseSpecifier4ClamAV4ClamXav(); |
| 151 |
# working directory |
# |
| 152 |
#$Setting{install}->{workdir} = sub { |
# # If you use ClamAntiVirusDaemon, uncomment following lines. |
| 153 |
# my ($latestVersion, $currentVersion) = @_; |
# #push @{$Phase{install}->{method}}, ( |
| 154 |
# |
# # [qw(/Library/StartupItems/ClamAntiVirusDaemon/ClamAntiVirusDaemon restart)], |
| 155 |
# sprintf('%s/%s-%s', |
# #); |
| 156 |
# $Setting{download}->{dstBase}, $Setting{download}->{name}, |
# |
| 157 |
# $latestVersion |
# # If you use FreshClamDaemon, uncomment following lines. |
| 158 |
# ); |
# #push @{$Phase{install}->{method}}, ( |
| 159 |
|
# # [qw(chown root /usr/local/clamXav/bin/freshclam)], |
| 160 |
|
# # [qw(chmod u-s /usr/local/clamXav/bin/freshclam)], |
| 161 |
|
# # [qw(/Library/StartupItems/FreshClamDaemon/FreshClamDaemon restart)], |
| 162 |
|
# #); |
| 163 |
|
# |
| 164 |
|
# # other customization |
| 165 |
|
# |
| 166 |
|
# # return success |
| 167 |
|
# 1; |
| 168 |
#}; |
#}; |
| 169 |
|
|
| 170 |
# phase commands sequence |
# for normal ClamAV user |
| 171 |
#$Setting{install}->{sequence} = [ |
#$Setting{phase}->{specifier} = \&PhaseSpecifier4General; |
| 172 |
# [qw(make install)], |
# If you want to customize phase specification, use following instead of |
| 173 |
# [qw(chown -R root:admin /usr/local/clamXav)], |
# above. |
| 174 |
# [qw(chmod 664 /usr/local/clamXav/etc/freshclam.conf)], |
#$Setting{phase}->{specifier} = sub { |
| 175 |
# [qw(chown clamav /usr/local/clamXav/bin/freshclam)], |
# # use build-in specifier |
| 176 |
# [qw(chmod u+s /usr/local/clamXav/bin/freshclam)], |
# PhaseSpecifier4General(); |
| 177 |
# [qw(touch /usr/local/clamXav/share/clamav/freshclam.log)], |
# |
| 178 |
# [qw(chmod 664 /usr/local/clamXav/share/clamav/freshclam.log)], |
# # If you use /etc/rc.d/init.d/clamd, uncomment following lines. |
| 179 |
# [qw(chown -R clamav:clamav /usr/local/clamXav/share/clamav)], |
# #push @{$Phase{install}->{method}}, ( |
| 180 |
# [qw(chmod -R ug+w /usr/local/clamXav/share/clamav)], |
# # [qw(/etc/rc.d/init.d/clamd restart)], |
| 181 |
#]; |
# #); |
| 182 |
|
# |
| 183 |
|
# # If you use /etc/rc.d/init.d/freshclam, uncomment following lines. |
| 184 |
#### Post-Install Phase Specification #### |
# #push @{$Phase{install}->{method}}, ( |
| 185 |
# common |
# # [qw(/etc/rc.d/init.d/freshclam restart)], |
| 186 |
# working directory |
# #); |
| 187 |
#$Setting{postInstall}->{workdir} = undef; |
# |
| 188 |
|
# # other customization |
| 189 |
# phase commands sequence |
# |
| 190 |
#$Setting{postInstall}->{sequence} = [ |
# # return success |
| 191 |
#]; |
# 1; |
| 192 |
|
#}; |
|
# using clamd (sample) |
|
|
#push @{$Setting{postInstall}->{sequence}}, |
|
|
# [qw(/Library/StartupItems/ClamAntiVirusDaemon/ClamAntiVirusDaemon restart)]; |
|
|
|
|
|
# using freshclam as a daemon (sample) |
|
|
#push @{$Setting{postInstall}->{sequence}}, |
|
|
# [qw(chown root /usr/local/clamXav/bin/freshclam)], |
|
|
# [qw(chmod u-s /usr/local/clamXav/bin/freshclam)], |
|
|
# [qw(/Library/StartupItems/FreshClamDaemon/FreshClamDaemon restart)]; |
|
|
|
|
|
|
|
|
#### Clean Phase Specification #### |
|
|
# common |
|
|
# working directory |
|
|
#$Setting{clean}->{workdir} = undef; |
|
|
|
|
|
# phase commands sequence |
|
|
#$Setting{clean}->{sequence} = [ |
|
|
# sub { |
|
|
# my ($latestVersion, $currentVersion) = @_; |
|
|
# my $dir = sprintf( |
|
|
# '%s/%s-%s', |
|
|
# $Setting{download}->{dstBase}, |
|
|
# $Setting{download}->{name}, |
|
|
# $latestVersion, |
|
|
# ); |
|
|
# my @cmd = ( |
|
|
# 'rm', '-rf', $dir, |
|
|
# sprintf('%s.%s', $dir, $Setting{download}->{ext}) |
|
|
# ); |
|
|
# |
|
|
# DoCommand(@cmd); |
|
|
# }, |
|
|
#]; |
|
| 193 |
|
|
| 194 |
|
|
| 195 |
#### DO NOT EDIT #### |
#### DO NOT EDIT #### |