From 395a5e0ccff73f9c9833d1ba8cf7e8c6c7a210cf Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Tue, 23 Jun 2009 15:49:45 +0200 Subject: [PATCH] koristi se carnet tools podrska za rsyslog --- debian/changelog | 8 +++++++ debian/control | 4 ++-- debian/postinst | 68 +++++++++++++++++------------------------------------- 3 files changed, 31 insertions(+), 49 deletions(-) diff --git a/debian/changelog b/debian/changelog index 65f663c..fad8871 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +amavis-stats-cn (0.1.12-3lenny2) stable; urgency=low + + * Dodan rsyslog u Recommends + * Podrska za rsyslog u postinstu + * Koristi se CARNet Tools + + -- Ivan Rako Tue, 23 Jun 2009 15:38:10 +0200 + amavis-stats-cn (0.1.12-3lenny1) stable; urgency=low * Prvo izdanje za lenny diff --git a/debian/control b/debian/control index d345e95..87a7228 100644 --- a/debian/control +++ b/debian/control @@ -7,8 +7,8 @@ Standards-Version: 3.6.1 Package: amavis-stats-cn Architecture: all -Depends: amavis-stats, amavisd-cn, makepasswd, perl-base, apache2-utils, apache2-cn -Recommends: sysklogd +Depends: amavis-stats, amavisd-cn, makepasswd, perl-base, apache2-utils, apache2-cn, carnet-tools-cn (>= 2.7) +Recommends: sysklogd, rsyslog Description: Virus statistics RRDtool frontend for Amavis Amavis-stats is a simple Amavis statistics generator based on RRDtool. It produces graphs of clean emails, spam emails and infected emails broken diff --git a/debian/postinst b/debian/postinst index 43a8779..33ea8b6 100755 --- a/debian/postinst +++ b/debian/postinst @@ -5,46 +5,40 @@ set -e [ "$1" = "configure" ] || exit 0 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx +# Load CARNet Tools +. /usr/share/carnet-tools/functions.sh + hostname=`hostname -f` cron="/etc/cron.d/amavis-stats" htpasswd="/usr/share/amavis-stats/.htpasswd" aconf="/etc/amavis-stats/apache.conf" # these two are used in mail package="amavis-stats-cn" -version="0.1.12-3lenny1" - -notify () { - if [ "x$1" = "x-mailonly" ]; then - shift - else - echo "$1" - fi - NOTICE="$NOTICE$1" - if [ `echo "$1" | wc -l` -eq 1 ]; then - NOTICE="$NOTICE -" - fi -} if [ ! -f $htpasswd ]; then passwd=`makepasswd` htpasswd -bc $htpasswd admin $passwd 2> /dev/null - notify "CN: amavis-stats URL is http://$hostname/amavis-stats/" - notify "CN: User: admin" - notify "CN: Password: $passwd" - notify "CN: Use \"htpasswd $htpasswd admin\" to change it." - notify "" + cp_echo "CN: amavis-stats URL is http://$hostname/amavis-stats/" + cp_echo "CN: User: admin" + cp_echo "CN: Password: $passwd" + cp_echo "CN: Use \"htpasswd $htpasswd admin\" to change it." + cp_echo "" fi # find out where the logs might lie cant_figure_out() { - notify "CN: Can't figure out log file, edit $cron yourself!" 1>&2 + cp_echo "CN: Can't figure out log file, edit $cron yourself!" 1>&2 } -sl=/etc/syslog.conf +if [ -f /etc/rsyslog.conf ]; then + sl=/etc/rsyslog.conf +else + sl=/etc/syslog.conf +fi + if grep -q /var/log/mail.info $cron; then if [ ! -e "$sl" ]; then - # no syslog.conf + # no syslog.conf or rsyslog.conf cant_figure_out elif pgrep syslog-ng > /dev/null; then # syslog-ng, I'm not parsing _that_. @@ -64,7 +58,7 @@ if grep -q /var/log/mail.info $cron; then sed "s,/var/log/mail.info,$log,g" < "$cron" > "${cron}.dpkg-tmp" if ! cmp -s "${cron}.dpkg-tmp" "$cron"; then cp "${cron}.dpkg-tmp" "$cron" - notify "CN: ${log} set as log file in ${cron}." + cp_echo "CN: ${log} set as log file in ${cron}." fi rm "${cron}.dpkg-tmp" fi @@ -77,7 +71,7 @@ if [ -f "$log" ] && [ "$(dirname $log)" = "/var/log/mail" ]; then if [ "$logdirgroup" != "adm" ]; then # whyever was it not adm? on woody it's mail, on sarge smmsp...? # and i'm not going to give amavis-stats privileges for those - notify "CN: chgrp adm /var/log/mail (was \"$logdirgroup\")." + cp_echo "CN: chgrp adm /var/log/mail (was \"$logdirgroup\")." chgrp adm /var/log/mail #chgrp smmsp /var/log/mail #addgroup amavis-stats smmsp > /dev/null @@ -108,36 +102,16 @@ EOF bak="$aconf.dpkg-old.$(date '+%Y-%m-%d')" if [ ! -f "$bak" ]; then cp -p "${aconf}" "$bak" - notify "CN: Old apache config saved as \"$bak\"." + cp_echo "CN: Old apache config saved as \"$bak\"." fi fi cp "${aconf}.dpkg-tmp" "$aconf" rm "${aconf}.dpkg-tmp" - notify "CN: Forced valid-user for amavis-stats web." + cp_echo "CN: Forced valid-user for amavis-stats web." reload=1 fi -if [ "$(echo $NOTICE|wc -w)" -gt 0 ]; then - echo "Mailing upgrade output to root." - NOTICE="From: $package postinst script -To: root -Subject: $package $version package install log -Date: $(/bin/date +'%a, %d %b %Y %H:%M:%S %z') - -Hello! - -The $package package has been successfully installed on your computer. -For your convenience, a partial output of the last $package installation -is included below. - ----------- -$NOTICE -----------" - - echo "$NOTICE" | /usr/sbin/sendmail -t & - sleep 1 -fi - +cp_mail $package if [ ! -L /etc/apache2/conf.d/amavis-stats-cn.conf -a ! -f /etc/apache2/conf.d/amavis-stats-cn.conf ]; then ln -sf /etc/amavis-stats/apache.conf /etc/apache2/conf.d/amavis-stats-cn.conf -- 1.7.10.4