From 3d860d257b17773f9a9395e1d4bb823bdd3dc8fb Mon Sep 17 00:00:00 2001 From: Grupa za izradu paketa Date: Mon, 22 Oct 2007 15:04:31 +0000 Subject: [PATCH 1/1] r1: [svn-inject] Installing original source of amavis-stats-cn --- README.CARNet | 14 +++++ changelog.CARNet | 1 + debian/changelog | 12 +++++ debian/compat | 1 + debian/control | 15 ++++++ debian/docs | 2 + debian/postinst | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ debian/postrm | 18 +++++++ debian/rules | 86 ++++++++++++++++++++++++++++++ 9 files changed, 301 insertions(+) create mode 100644 README.CARNet create mode 120000 changelog.CARNet create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/docs create mode 100755 debian/postinst create mode 100755 debian/postrm create mode 100755 debian/rules diff --git a/README.CARNet b/README.CARNet new file mode 100644 index 0000000..42799e8 --- /dev/null +++ b/README.CARNet @@ -0,0 +1,14 @@ +amavis-stats-cn + +Ovaj paket sadrzi dodatne CARNetove postavke za paket iz distribucije. +U odnosu na Debianovu konfiguraciju, izmijenjene su sljedece postavke: + - dodana HTTP BASIC autentikacija i korisnik "admin" za amavis-stats web, + . + - postavljeno vlasnistvo /var/log/mail direktorija na adm grupu + +amavis-stats nece raditi ispravno ukoliko su "rotirani" logovi komprimirani. +Dodajte opciju "delaycompress" u konfiguraciju za rotaciju mail.info logova +ako vas syslog sustav koristi logrotate, poput syslog-ng. Uobicajeni Debianov +sysklogd paket koristi vlastiti "savelog" i ne zahtijeva dodatne izmjene. + + -- Zoran Dzelajlija Mon, 27 Dec 2004 20:23:02 +0100 diff --git a/changelog.CARNet b/changelog.CARNet new file mode 120000 index 0000000..194579e --- /dev/null +++ b/changelog.CARNet @@ -0,0 +1 @@ +changelog.Debian \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..73e5d9a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,12 @@ +amavis-stats-cn (0.1.12-2) carnet-etch; urgency=low + + * Prvo izdanje za Etch + + -- Ivan Rako Mon, 22 Oct 2007 16:55:13 +0200 + +amavis-stats-cn (0.1.12-1) sarge; urgency=low + + * Prvo izdanje. + + -- Zoran Dzelajlija Mon, 27 Dec 2004 20:23:02 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..dc1d7cf --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: amavis-stats-cn +Section: mail +Priority: optional +Maintainer: Ivan Rako +Build-Depends: debhelper (>= 4.0.0) +Standards-Version: 3.6.1 + +Package: amavis-stats-cn +Architecture: all +Depends: amavis-stats, makepasswd, perl-base +Recommends: sysklogd +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 + down by virus, from amavis log entries. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..d92e2d1 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +README.CARNet +changelog.CARNet diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..2c5064c --- /dev/null +++ b/debian/postinst @@ -0,0 +1,152 @@ +#!/bin/sh + +set -e + +[ "$1" = "configure" ] || exit 0 + +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-2" + +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 "" +fi + +# find out where the logs might lie +cant_figure_out() { + notify "CN: Can't figure out log file, edit $cron yourself!" 1>&2 +} + +sl=/etc/syslog.conf +if grep -q /var/log/mail.info $cron; then + if [ ! -e "$sl" ]; then + # no syslog.conf + cant_figure_out + elif pgrep syslog-ng > /dev/null; then + # syslog-ng, I'm not parsing _that_. + cant_figure_out + elif ! grep -q '^mail.info[ ][ ]*-?/var/log/mail.info' $sl; then + # where oh where does mail.info go to? + log=$(awk '$1 == "mail.info" {print $2}' < $sl | sed 's/^-//' | head -1) + [ -z "$log" ] && \ + log=$(awk '$1 == "mail.*" {print $2}' < $sl | sed 's/^-//' | head -1) + [ -z "$log" ] && \ + log=$(awk '$1 ~ /mail\.info/ {print $2}' < $sl | sed 's/^-//' | head -1) + [ -z "$log" ] && \ + log=$(awk '$1 ~ /mail\.\*/ {print $2}' < $sl | sed 's/^-//' | head -1) + if [ -z "$log" ]; then + cant_figure_out + else + 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}." + fi + rm "${cron}.dpkg-tmp" + fi + fi +fi + +# ash's [ continues after -a, so we need && here +if [ -f "$log" ] && [ "$(dirname $log)" = "/var/log/mail" ]; then + logdirgroup=$(ls -ld /var/log/mail | awk '{print $4}') + 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\")." + chgrp adm /var/log/mail + #chgrp smmsp /var/log/mail + #addgroup amavis-stats smmsp > /dev/null + fi +fi + +if ! grep -iq 'valid-user' $aconf; then + cat > ${aconf}.dpkg-tmp < + Options +FollowSymLinks + AllowOverride None + order allow,deny + allow from all + + AuthType Basic + AuthName amavis-stats + AuthUserFile $htpasswd + + + require valid-user + + +EOF + # If default debian file, don't bother to save it + if [ "$(md5sum $aconf|awk '{print $1}')" != "b6820ee83bc5b6386c72428f42950b6b" ]; then + bak="$aconf.dpkg-old.$(date '+%Y-%m-%d')" + if [ ! -f "$bak" ]; then + cp -p "${aconf}" "$bak" + notify "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." + 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 + + +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 + reload_apache2="yes" +fi + +if [ "$reload_apache2" = "yes" ]; then + if [ -x /usr/sbin/invoke-rc.d ]; then + [ -x /etc/init.d/apache2 ] && invoke-rc.d apache2 reload || true + else + [ -x /etc/init.d/apache2 ] && /etc/init.d/apache2 reload || true + fi +fi diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..d14563a --- /dev/null +++ b/debian/postrm @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e + +[ "$1" = "purge" ] || exit 0 + +if [ /etc/apache2/conf.d/amavis-stats-cn.conf ]; then + rm -f /etc/apache2/conf.d/amavis-stats-cn.conf + reload_apache2="yes" +fi + +if [ "$reload_apache2" = "yes" ]; then + if [ -x /usr/sbin/invoke-rc.d ]; then + [ -x /etc/init.d/apache2 ] && invoke-rc.d apache2 reload || true + else + [ -x /etc/init.d/apache2 ] && /etc/init.d/apache2 reload || true + fi +fi diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..a72957b --- /dev/null +++ b/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + # $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + # -$(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/amavis-stats-cn. + # $(MAKE) install DESTDIR=$(CURDIR)/debian/amavis-stats-cn + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs -k + dh_installdocs +# dh_installexamples + dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman +# dh_link +# dh_strip +# dh_compress + dh_fixperms +# dh_perl +# dh_python +# dh_makeshlibs + dh_installdeb +# dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure -- 1.7.10.4