Sun, 01 Nov 2009 15:44:08 +0100
Import package vendor original specs for necessary manipulations.
clamav/rc.clamav | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/clamav/rc.clamav Sun Nov 01 15:44:08 2009 +0100 1.3 @@ -0,0 +1,114 @@ 1.4 +#!@l_prefix@/bin/openpkg rc 1.5 +## 1.6 +## rc.clamav -- Run-Commands 1.7 +## 1.8 + 1.9 +%config 1.10 + clamav_enable="$openpkg_rc_def" 1.11 + clamav_daemons="clamd clamav-milter" 1.12 + clamav_clamd_flags="" 1.13 + clamav_clamav_milter_flags="" 1.14 + clamav_update="daily" 1.15 + clamav_log_prolog="true" 1.16 + clamav_log_epilog="true" 1.17 + clamav_log_numfiles="10" 1.18 + clamav_log_minsize="1M" 1.19 + clamav_log_complevel="9" 1.20 + 1.21 +%common 1.22 + clamav_cfgfile="@l_prefix@/etc/clamav/clamd.conf" 1.23 + clamav_pidfile_clamd="@l_prefix@/var/clamav/clamd.pid" 1.24 + clamav_pidfile_clamav_milter="@l_prefix@/var/clamav/clamav-milter.pid" 1.25 + clamav_signal () { 1.26 + [ -f $clamav_pidfile_clamd ] \ 1.27 + && kill -$1 `cat $clamav_pidfile_clamd` 1.28 + local rc_clamav_clamd=$? 1.29 + [ -f $clamav_pidfile_clamav_milter ] \ 1.30 + && kill -$1 `cat $clamav_pidfile_clamav_milter` 1.31 + local rc_clamav_clamav_milter=$? 1.32 + [ $rc_clamav_clamd -eq 0 \ 1.33 + -o $rc_clamav_clamav_milter -eq 0 ] 1.34 + } 1.35 + 1.36 +%status -u @l_rusr@ -o 1.37 + clamav_usable="unknown" 1.38 + clamav_active="no" 1.39 + rcService clamav enable yes && \ 1.40 + clamav_signal 0 && clamav_active="yes" 1.41 + echo "clamav_enable=\"$clamav_enable\"" 1.42 + echo "clamav_usable=\"$clamav_usable\"" 1.43 + echo "clamav_active=\"$clamav_active\"" 1.44 + 1.45 +%start -u @l_rusr@ 1.46 + rcService clamav enable yes || exit 0 1.47 + rcService clamav active yes && exit 0 1.48 + for daemon in $clamav_daemons; do 1.49 + if [ ".$daemon" = ".clamd" ]; then 1.50 + @l_prefix@/sbin/clamd \ 1.51 + --config-file=$clamav_cfgfile \ 1.52 + $clamav_clamd_flags 1.53 + elif [ ".$daemon" = ".clamav-milter" -a -x @l_prefix@/sbin/clamav-milter ]; then 1.54 + ( umask 002 1.55 + @l_prefix@/sbin/clamav-milter \ 1.56 + --config-file=$clamav_cfgfile \ 1.57 + --max-children=4 --outgoing --local \ 1.58 + --pidfile=$clamav_pidfile_clamav_milter \ 1.59 + --sendmail-cf=/dev/null \ 1.60 + $clamav_clamav_milter_flags \ 1.61 + local:@l_prefix@/var/milter/socket/clamav-milter 1.62 + ) || exit $? 1.63 + fi 1.64 + done 1.65 + 1.66 +%stop -u @l_rusr@ 1.67 + rcService clamav enable yes || exit 0 1.68 + rcService clamav active no && exit 0 1.69 + clamav_signal TERM 1.70 + rm -f $clamav_pidfile_clamd 2>/dev/null || true 1.71 + rm -f $clamav_pidfile_clamav_milter 2>/dev/null || true 1.72 + 1.73 +%restart -u @l_rusr@ 1.74 + rcService clamav enable yes || exit 0 1.75 + rcService clamav active no && exit 0 1.76 + rc clamav stop 1.77 + sleep 2 1.78 + rc clamav start 1.79 + 1.80 +%quarterly -u @l_rusr@ 1.81 + rcService clamav enable yes || exit 0 1.82 + if [ ".$clamav_update" = .quarterly ]; then 1.83 + @l_prefix@/bin/freshclam 1.84 + if [ $? -ge 10 ]; then exit $?; fi 1.85 + fi 1.86 + 1.87 +%hourly -u @l_rusr@ 1.88 + rcService clamav enable yes || exit 0 1.89 + if [ ".$clamav_update" = .hourly ]; then 1.90 + @l_prefix@/bin/freshclam 1.91 + if [ $? -ge 10 ]; then exit $?; fi 1.92 + fi 1.93 + 1.94 +%daily -u @l_rusr@ 1.95 + rcService clamav enable yes || exit 0 1.96 + if [ ".$clamav_update" = .daily ]; then 1.97 + @l_prefix@/bin/freshclam 1.98 + if [ $? -ge 10 ]; then exit $?; fi 1.99 + fi 1.100 + logfiles="" 1.101 + for daemon in freshclam $clamav_daemons; do 1.102 + logfiles="$logfiles @l_prefix@/var/clamav/$daemon.log" 1.103 + done 1.104 + shtool rotate -f \ 1.105 + -n $clamav_log_numfiles -s $clamav_log_minsize -d \ 1.106 + -z $clamav_log_complevel -o @l_rusr@ -g @l_rgrp@ -m 644 \ 1.107 + -P "$clamav_log_prolog" \ 1.108 + -E "$clamav_log_epilog; rc clamav restart" \ 1.109 + $logfiles 1.110 + 1.111 +%weekly -u @l_rusr@ 1.112 + rcService clamav enable yes || exit 0 1.113 + if [ ".$clamav_update" = .weekly ]; then 1.114 + @l_prefix@/bin/freshclam 1.115 + if [ $? -ge 10 ]; then exit $?; fi 1.116 + fi 1.117 +