From df6447ce620a5d010c17ba6413ac6a1fd59d0868 Mon Sep 17 00:00:00 2001
From: Grupa za izradu paketa <paketi@carnet.hr>
Date: Thu, 25 Oct 2007 18:57:28 +0000
Subject: [PATCH 1/1] r1: [svn-inject] Installing original source of
 webalizer-cn

---
 debian/README.CARNet    |   20 ++++++++++++++
 debian/changelog        |    1 +
 debian/changelog.CARNet |   22 +++++++++++++++
 debian/compat           |    1 +
 debian/control          |   26 ++++++++++++++++++
 debian/dirs             |    1 +
 debian/docs             |    2 ++
 debian/install          |    1 +
 debian/postinst         |   62 ++++++++++++++++++++++++++++++++++++++++++
 debian/prerm            |    8 ++++++
 debian/rules            |   68 +++++++++++++++++++++++++++++++++++++++++++++++
 webalizer-cn.conf       |   10 +++++++
 12 files changed, 222 insertions(+)
 create mode 100644 debian/README.CARNet
 create mode 120000 debian/changelog
 create mode 100644 debian/changelog.CARNet
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/dirs
 create mode 100644 debian/docs
 create mode 100644 debian/install
 create mode 100755 debian/postinst
 create mode 100755 debian/prerm
 create mode 100755 debian/rules
 create mode 100644 webalizer-cn.conf

diff --git a/debian/README.CARNet b/debian/README.CARNet
new file mode 100644
index 0000000..07e0ee2
--- /dev/null
+++ b/debian/README.CARNet
@@ -0,0 +1,20 @@
+webalizer-cn
+------------
+
+Webalizer stranicama mozete pristupiti na web adresi
+
+  http://host.domena.hr/stats/
+
+gdje je 'host' hostname posluzitelja na kojem je webalizer-cn
+paket instaliran, a 'domena.hr' domena Vase ustanove.
+
+Pristup se postavlja pomocu 'htpasswd' alata. Datoteka koja
+sadrzi popis korisnika i zaporke nalazi se na lokaciji:
+
+  /var/www/webalizer/.htpasswd
+
+Pocetna zaporka za pristup je poslana root korisniku prilikom 
+instalacije paketa.
+
+
+ -- Dragan Dosen <ddosen@ffzg.hr>  Thu, 25 Oct 2007 17:21:17 +0200
diff --git a/debian/changelog b/debian/changelog
new file mode 120000
index 0000000..cafa7f7
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1 @@
+changelog.CARNet
\ No newline at end of file
diff --git a/debian/changelog.CARNet b/debian/changelog.CARNet
new file mode 100644
index 0000000..da122df
--- /dev/null
+++ b/debian/changelog.CARNet
@@ -0,0 +1,22 @@
+webalizer-cn (2.01.10-32) etch; urgency=low
+
+  * Prva inacica paketa za Debian etch distribuciju.
+  * Paket od sada ovisi o Apache2 web serveru (apache2-cn Debian paket).
+  * Izmjene unutar postinst skripte - koriste se cp_echo i cp_mail
+    funkcije iz carnet-tools-cn paketa.
+  * U slucaju da se prije koristio Apache 1.x web server, Webalizer
+    konfiguracija iz /etc/apache/conf.d/ se prebacuje u direktorij
+    /etc/apache2/conf.d/.
+  * Konfiguracija za Webalizer se nalazi na novim lokacijama:
+      - /etc/webalizer/webalizer.conf
+      - /etc/apache2/conf.d/webalizer-cn.conf
+
+ -- Dragan Dosen <ddosen@ffzg.hr>  Thu, 25 Oct 2007 17:21:17 +0200
+
+webalizer-cn (2.01.10-1) sarge; urgency=low
+
+  * Inicijalno izdanje paketa, NMU.
+  * Postavljen /stats/ link koji radi bez obzira na DocumentRoot.
+  * Dodana sifra za pristup (copy/paste Icinih skripti za mrtg-cn, thanks!).
+
+ -- Zoran Dzelajlija <jelly+paketi@srce.hr>  Wed, 31 Mar 2004 01:43:20 +0200
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..ad40d25
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,26 @@
+Source: webalizer-cn
+Section: web
+Origin: carnet
+Priority: optional
+Maintainer: Dragan Dosen <ddosen@ffzg.hr>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.1
+
+Package: webalizer-cn
+Architecture: all
+Pre-Depends: apache2-cn (>= 2.2)
+Depends: webalizer (>= 2.01.10-32), apache-common (>= 1.3.29), makepasswd, carnet-tools-cn (>= 2.0), perl (>= 5.8.4-2)
+Description: web server log analysis program
+ The Webalizer was designed to scan web server log files in various formats
+ and produce usage statistics in  HTML format for viewing through a browser.
+ The Webalizer produces yearly, monthly, daily and hourly statistics. In the
+ monthly reports, various statistics may be produced to show overall usage,
+ usage by day and hour, usage by visiting sites, URLs, user agents
+ (browsers), referrers and country. The Webalizer is highly configurable by
+ use of either command line options or a configuration file, allowing the
+ program to be tailored to individual needs easily.
+ .
+ Homepage: http://www.mrunix.net/webalizer/
+ .
+ This package provides CARNet configuration for Webalizer.
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..1afa9e4
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+/etc/webalizer
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..9f08072
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,2 @@
+debian/README.CARNet
+debian/changelog.CARNet
\ No newline at end of file
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..aa8edde
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+webalizer-cn.conf /etc/apache2/conf.d
\ No newline at end of file
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000..a3b3604
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+[ "$1" = "configure" ] || exit 0
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -x
+
+# Load CARNet Tools
+. /usr/share/carnet-tools/functions.sh
+
+# Debconf
+. /usr/share/debconf/confmodule
+
+# Get some useful functions (apache-common)
+. /usr/share/apache/postinst.common
+
+dir=/var/www/webalizer
+htpasswd=$dir/.htpasswd
+CONF=/etc/webalizer/webalizer.conf
+BACKUPDIR=/var/backups
+CONFBAK=$BACKUPDIR/`basename $CONF`.bak
+oldreporttitle="Usage Statistics for"
+reporttitle="Statistika pristupa za"
+
+
+# Check if there is some old webalizer-cn.conf file in Apache 1.x conf.d directory  -ddosen
+if [ -f "/etc/apache/conf.d/webalizer-cn.conf" ]; then
+	if ! cmp -s "/etc/apache/conf.d/webalizer-cn.conf" "/etc/apache2/conf.d/webalizer-cn.conf"; then
+		mv /etc/apache/conf.d/webalizer-cn.conf /etc/apache2/conf.d/webalizer-cn.conf
+	fi
+fi
+
+temp=`pget $CONF OutputDir |tail -n 1|awk '{print $NF}'`
+if [ "$temp" != "$dir" ]; then
+	#cp_echo "CN: Found custom OutputDir value: $temp, not touching anything!"
+	db_set webalizer/directory "$temp" || true
+fi
+
+# Customise ReportTitle
+temp=`pget $CONF ReportTitle |tail -n 1|perl -pe 's/(ReportTitle\s+?)(.*$)/$2/'`
+if [ "$temp" = "$oldreporttitle" ]; then
+	pset $CONF ReportTitle "$reporttitle"
+	db_set webalizer/doc_title "$reporttitle" || true
+fi
+
+db_stop
+
+# Reload Apache2 web server
+if [ -x /etc/init.d/apache2 ]; then
+	/etc/init.d/apache2 reload || true
+fi
+
+# Send mail with informations
+if [ ! -f $htpasswd ]; then
+	passwd=`makepasswd`
+	htpasswd -bc $htpasswd admin $passwd 2> /dev/null
+	cp_echo ""
+	cp_echo "CN: Webalizer URL is http://`hostname -f`/stats/"
+	cp_echo "CN:            User: admin"
+	cp_echo "CN:        Password: $passwd"
+        cp_echo ""
+        cp_echo "CN: Use \"htpasswd $htpasswd admin\" to change it."
+	cp_mail "webalizer-cn"
+fi
diff --git a/debian/prerm b/debian/prerm
new file mode 100755
index 0000000..2fec6c6
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+[ "$1" = "remove" ] || exit 0
+
+# Placeholder    
+exit 0
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..049ea8d
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,68 @@
+#!/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.
+
+#export DH_VERBOSE=1
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+binary-indep: build install
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+#	dh_installchangelogs 
+	dh_installdocs
+	dh_install -X.svn
+#	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 -x
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/webalizer-cn.conf b/webalizer-cn.conf
new file mode 100644
index 0000000..d211686
--- /dev/null
+++ b/webalizer-cn.conf
@@ -0,0 +1,10 @@
+Alias /stats /var/www/webalizer
+<Directory /var/www/webalizer>
+	AuthType Basic
+	AuthName Stats
+	AuthUserFile /var/www/webalizer/.htpasswd
+
+	<Limit GET POST>
+		require valid-user
+	</Limit>
+</Directory>
-- 
1.7.10.4