clamav/rc.clamav

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
parent 233
f5f6e93f3dc6
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.clamav -- Run-Commands
     4 ##
     6 %config
     7     clamav_enable="$openpkg_rc_def"
     8     clamav_daemons="clamd clamav-milter"
     9     clamav_clamd_flags=""
    10     clamav_clamav_milter_flags=""
    11     clamav_update="daily"
    12     clamav_log_prolog="true"
    13     clamav_log_epilog="true"
    14     clamav_log_numfiles="10"
    15     clamav_log_minsize="1M"
    16     clamav_log_complevel="9"
    18 %common
    19     clamav_cfgfile="@l_prefix@/etc/clamav/clamd.conf"
    20     clamav_milter_cfgfile="@l_prefix@/etc/clamav/clamav-milter.conf"
    21     clamav_pidfile_clamd="@l_prefix@/var/clamav/clamd.pid"
    22     clamav_pidfile_clamav_milter="@l_prefix@/var/clamav/clamav-milter.pid"
    23     clamav_signal () {
    24         [ -f $clamav_pidfile_clamd ] \
    25             && kill -$1 `cat $clamav_pidfile_clamd`
    26         local rc_clamav_clamd=$?
    27         [ -f $clamav_pidfile_clamav_milter ] \
    28             && kill -$1 `cat $clamav_pidfile_clamav_milter`
    29         local rc_clamav_clamav_milter=$?
    30         [    $rc_clamav_clamd         -eq 0 \
    31           -o $rc_clamav_clamav_milter -eq 0 ]
    32     }
    34 %status -u @l_rusr@ -o
    35     clamav_usable="unknown"
    36     clamav_active="no"
    37     rcService clamav enable yes && \
    38         clamav_signal 0 && clamav_active="yes"
    39     echo "clamav_enable=\"$clamav_enable\""
    40     echo "clamav_usable=\"$clamav_usable\""
    41     echo "clamav_active=\"$clamav_active\""
    43 %start -u @l_rusr@
    44     rcService clamav enable yes || exit 0
    45     rcService clamav active yes && exit 0
    46     for daemon in $clamav_daemons; do
    47         if [ ".$daemon" = ".clamd" ]; then
    48             @l_prefix@/sbin/clamd \
    49                 --config-file=$clamav_cfgfile \
    50                 $clamav_clamd_flags
    51         elif [ ".$daemon" = ".clamav-milter" -a -x @l_prefix@/sbin/clamav-milter ]; then
    52             ( umask 002
    53               @l_prefix@/sbin/clamav-milter \
    54                   --config-file=$clamav_milter_cfgfile \
    55                   $clamav_clamav_milter_flags
    56              ) || exit $?
    57         fi
    58     done
    60 %stop -u @l_rusr@
    61     rcService clamav enable yes || exit 0
    62     rcService clamav active no && exit 0
    63     clamav_signal TERM
    64     rm -f $clamav_pidfile_clamd 2>/dev/null || true
    65     rm -f $clamav_pidfile_clamav_milter 2>/dev/null || true
    67 %restart -u @l_rusr@
    68     rcService clamav enable yes || exit 0
    69     rcService clamav active no && exit 0
    70     rc clamav stop
    71     sleep 2
    72     rc clamav start
    74 %quarterly -u @l_rusr@
    75     rcService clamav enable yes || exit 0
    76     if [ ".$clamav_update" = .quarterly ]; then
    77         @l_prefix@/bin/freshclam
    78         if [ $? -ge 10 ]; then exit $?; fi
    79     fi
    81 %hourly -u @l_rusr@
    82     rcService clamav enable yes || exit 0
    83     if [ ".$clamav_update" = .hourly ]; then
    84         @l_prefix@/bin/freshclam
    85         if [ $? -ge 10 ]; then exit $?; fi
    86     fi
    88 %daily -u @l_rusr@
    89     rcService clamav enable yes || exit 0
    90     if [ ".$clamav_update" = .daily ]; then
    91         @l_prefix@/bin/freshclam
    92         if [ $? -ge 10 ]; then exit $?; fi
    93     fi
    94     logfiles=""
    95     for daemon in freshclam $clamav_daemons; do
    96         logfiles="$logfiles @l_prefix@/var/clamav/$daemon.log"
    97     done
    98     shtool rotate -f \
    99         -n $clamav_log_numfiles -s $clamav_log_minsize -d \
   100         -z $clamav_log_complevel -o @l_rusr@ -g @l_rgrp@ -m 644 \
   101         -P "$clamav_log_prolog" \
   102         -E "$clamav_log_epilog; rc clamav restart" \
   103         $logfiles
   105 %weekly -u @l_rusr@
   106     rcService clamav enable yes || exit 0
   107     if [ ".$clamav_update" = .weekly ]; then
   108         @l_prefix@/bin/freshclam
   109         if [ $? -ge 10 ]; then exit $?; fi
   110     fi

mercurial