--- torrus-1.0.8.orig/debian/torrus-common.NEWS
+++ torrus-1.0.8/debian/torrus-common.NEWS
@@ -0,0 +1,7 @@
+torrus (1.0.6-1) unstable; urgency=low
+
+  Please be aware that you need to recompile your torrus configuration
+  after updating to torrus 1.0.6. Otherwise the collector will hang
+  forever on startup, unfortunately without giving any error message.
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Fri, 07 Mar 2008 20:01:13 +0100
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.xmlconfig
+++ torrus-1.0.8/debian/torrus-common.doc-base.xmlconfig
@@ -0,0 +1,13 @@
+Document: torrus-xmlconfig
+Title: Torrus XML Configuration Guide
+Author: Stanislav Sinyagin
+Abstract: The guide to creation, modification, extension and
+ management of Torrus XML configuration files.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/xmlconfig.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/xmlconfig.html
+Files: /usr/share/doc/torrus-common/xmlconfig.html
--- torrus-1.0.8.orig/debian/README.source
+++ torrus-1.0.8/debian/README.source
@@ -0,0 +1,2 @@
+This package uses vanilla dpatch. Please see
+/usr/share/doc/dpatch/README.source.gz for reference.
\ No newline at end of file
--- torrus-1.0.8.orig/debian/torrus-apache.links
+++ torrus-1.0.8/debian/torrus-apache.links
@@ -0,0 +1 @@
+usr/share/doc/torrus-common	usr/share/doc/torrus-apache
--- torrus-1.0.8.orig/debian/torrus-common.postinst
+++ torrus-1.0.8/debian/torrus-common.postinst
@@ -0,0 +1,35 @@
+#!/bin/sh
+set -e
+
+configure_user_group() {
+#   Create the user/group. It only returns non-zero if there is some real
+#   error, so in that case it's better to bail out anyway.
+    adduser --quiet --system --no-create-home \
+            --force-badname --group Debian-torrus > /dev/null 2>&1
+}
+
+fix_owner_perm() {
+    chown -R Debian-torrus:Debian-torrus /var/lib/torrus /var/cache/torrus \
+	                                 /var/log/torrus
+    chmod g+s /var/lib/torrus/db
+    chmod g+w /var/lib/torrus/db /var/cache/torrus /var/log/torrus
+    chmod g+w /var/lib/torrus/session_data/lock /var/lib/torrus/session_data/store
+    addgroup www-data Debian-torrus > /dev/null 2>&1
+}
+
+case "$1" in
+    configure)	
+	configure_user_group
+	fix_owner_perm
+	;;
+    abort-upgrade|abort-remove|abort-deconfigure)
+	;;
+    *)
+	echo "${0} called with unknown argument ${1}"
+	exit 1
+	;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- torrus-1.0.8.orig/debian/torrus-apache2.install
+++ torrus-1.0.8/debian/torrus-apache2.install
@@ -0,0 +1 @@
+debian/torrus-apache2.conf /etc/torrus
--- torrus-1.0.8.orig/debian/initscript.siteconf
+++ torrus-1.0.8/debian/initscript.siteconf
@@ -0,0 +1,71 @@
+#####################################################################
+# This file may define some variables, controlling the initialization
+# of Torrus daemons via /etc/init.d/torrus-common script.
+# It also contains configuration data for the rrdup_notify script that
+# may be run from cron.
+# If a variable is not defined, the default value will be assumed.
+# To modify the value, uncomment the line with the variable definition
+# and edit it.
+#####################################################################
+# Daemons to start. By default an attempt is made to start both
+# collector and monitor daemons for all configured trees. The
+# per-tree customization may be achieved by modifying the
+# tree configuration in /etc/torrus/conf/torrus-siteconfig.pl
+#
+# TORRUS_DAEMONS='collector monitor'
+#####################################################################
+# Extra options which will be supplied to all daemons when
+# launching them, like '--verbose' or '--debug', for example.
+#
+# TORRUS_CMDOPTS=''
+#####################################################################
+# These variables control how the Torrus daemons are stopped. When
+# the initialization script is called with 'stop' argument, all
+# active Torrus daemon processes will be sent a TERM signal. After
+# that it will sleep for ${TORRUS_KILL_SLEEP} seconds and check,
+# whether the daemons have actually terminated. If not, it will
+# repeat the procedure of sending a TERM signal and sleeping for
+# ${TORRUS_KILL_SLEEP} seconds until either the daemons exit or 
+# ${TORRUS_KILL_COUNT} attempts to stop them have been made. After
+# that the remaining processes will be sent the KILL signals and their
+# PID files will be unconditionally removed. Note that in the
+# worst case scenario (using the default values) you might need 
+# to wait up to 100 seconds for this procedure to finish.
+#
+# TORRUS_KILL_COUNT='9'
+# TORRUS_KILL_SLEEP='10'
+#####################################################################
+# This variable controls the amount of details the init script
+# outputs while stopping the Torrus daemons. Default setting is
+# 'no', which causes it to output just one informational message. 
+# Setting it to 'yes' causes the details about signal sending, number
+# of retries and progress bars during waiting periods to be displayed.
+#
+# TORRUS_VERBOSE='no'
+#####################################################################
+# This variable implements a default delay of 20 minutes before
+# starting the monitor daemons, giving the collector daemon a 
+# chance to actually collect some data, before starting the
+# monitoring. The value of this variable (if non-empty) is appended
+# as an option to the invocation of the monitor daemon. 
+#
+# TORRUS_MONITOR_DELAY='--delay=20'
+#####################################################################
+# This variable allows to pass extra options to the collector daemon
+# only.
+#
+# TORRUS_COLLECTOR_CMDOPTS=''
+#####################################################################
+# If this variable is set, rrdup_notify runs and sends any findings
+# to the mail address set here.
+#
+# RRDUP_N_NOTIFY=root
+#####################################################################
+# Where the RRD files are located. Separate multiple paths with space
+#
+# RRDUP_N_RRDSTORAGE=/var/lib/torrus/collector_rrd
+#####################################################################
+# Maximum allowed age of an RRD file, in minutes
+#
+# RRDUP_N_MAXAGE=60
+#####################################################################
--- torrus-1.0.8.orig/debian/torrus-common.postrm
+++ torrus-1.0.8/debian/torrus-common.postrm
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+if [ "$1" = "purge" ] ; then
+    rm -rf /var/run/torrus /var/log/torrus /var/lib/torrus /var/cache/torrus
+fi
+
+#DEBHELPER#
+
+exit 0
--- torrus-1.0.8.orig/debian/torrus-apache2.postinst
+++ torrus-1.0.8/debian/torrus-apache2.postinst
@@ -0,0 +1,44 @@
+#!/bin/sh
+# All the non-zero exit codes mean that something is seriously broken
+set -e
+
+# Here we only have one possible configuration directory
+
+configure_apache() {
+    test -d /etc/apache2/conf.d || exit 2
+    if ! test -L /etc/apache2/conf.d/torrus-apache2.conf; then
+	ln -s ../../torrus/torrus-apache2.conf /etc/apache2/conf.d/torrus-apache2.conf
+    fi
+#   Make sure that mod_apreq is available and loaded
+    test -f /etc/apache2/mods-available/apreq.load || exit 3
+    test -L /etc/apache2/mods-enabled/apreq.load || \
+	 ln -s /etc/apache2/mods-available/apreq.load /etc/apache2/mods-enabled/apreq.load
+	
+#   Check the syntax
+    if ! apache2ctl configtest > /dev/null 2>&1 ; then
+      echo >&2 "apache2ctl configtest exited with a non-zero exit code"
+      apache2ctl configtest
+      exit 4
+    fi
+#   Reload the configuration
+    if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then
+       invoke-rc.d apache2 reload > /dev/null 2>&1 || true
+    else
+       /etc/init.d/apache2 reload > /dev/null 2>&1 || true
+    fi
+}
+
+case "$1" in
+    configure)	
+	configure_apache
+	;;
+    abort-upgrade|abort-remove|abort-deconfigure)
+	;;
+    *)
+	exit 0
+	;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- torrus-1.0.8.orig/debian/torrus-common.links
+++ torrus-1.0.8/debian/torrus-common.links
@@ -0,0 +1,2 @@
+usr/share/man/man7/torrus_action_snmptrap.7.gz usr/share/man/man7/torrus_action_snmpv1trap.7.gz
+etc/torrus/conf/initscript.siteconf etc/default/torrus-common
--- torrus-1.0.8.orig/debian/torrus-common.README.Debian
+++ torrus-1.0.8/debian/torrus-common.README.Debian
@@ -0,0 +1,181 @@
+
+1. How do I report bugs in Torrus for Debian GNU/Linux?
+2. How do I manually configure the Apache web server to use Torrus?
+3. Why does stopping the Torrus daemons sometimes take forever? 
+4. Where should I put my own XML templates and tree definitions?
+5. File locations are completely different from the original
+   (non-Debian) Torrus installation. Why and where are the files now?
+6. What other changes have been done to the original source?
+7. "Cannot create BerkeleyDB Environment: DB_VERSION_MISMATCH"
+
+======================================================================
+
+1. How do I report bugs in Torrus packages for Debian GNU/Linux?
+
+In order to package Torrus for the Debian GNU/Linux distribution
+certain minor modifications to the original source have been made (see
+question 6 for a list). It is therefore important, that the bugs
+discovered in Torrus on a Debian GNU/Linux system would be first
+reported to the Torrus Debian package maintainer, using the Debian
+bug-tracking system [1.1] (preferably, using reportbug utility). There
+is also a chance that the bug you've discovered is already known, so
+please consult the existing bug list [1.2] before reporting. You can
+also have a look at the pkg-torrus project homepage [1.3] or contact
+the pkg-torrus-general mailing list [1.4] with your problems or concerns.
+
+Before reporting a bug please make sure that this is a real problem.
+A typical example is a situation in which Torrus displays incorrect or
+erroneous information due to some misconfiguration. The incorrectly
+generated web pages get cached both by Torrus and your browser, so it
+might appear that the problem still persists, even after the
+configuration has been corrected. To make sure that there is really a
+bug in Torrus, please do the following:
+
+* Stop the Apache web server by running '/etc/init.d/apache2 stop'.
+* Stop Torrus daemons by running '/etc/init.d/torrus-common stop'.
+* Clear the Torrus Renderer cache by running the 'torrus clearcache'
+  command.
+* Start Torrus daemons ('/etc/init.d/torrus-common start').
+* Start the Apache daemon ('/etc/init.d/apache2 start').
+* Clear your browser's cache before viewing Torrus pages. If browser
+  supports different profiles, create one from scratch. This will
+  guarantee that no old data is left in the cache.
+
+[1.1] http://bugs.debian.org
+[1.2] http://bugs.debian.org/torrus-common
+[1.3] http://pkg-torrus.alioth.debian.org
+[1.4] pkg-torrus-general@lists.alioth.debian.org 
+
+======================================================================
+
+2. How do I manually configure the Apache web server to use Torrus?
+
+Torrus dependencies may be satisfied in a number of different ways,
+so it is pretty hard to predict all possible combinations.
+If the installation succeeded and you have defined some datasource
+trees (see Torrus User Guide [2.1] for tips on configuring them), you
+should be able to direct your browser to http://localhost/torrus and
+see the Torrus login page. If the login page is not displayed, check
+Torrus logs in /var/log/torrus and Apache error logs for clues. Please
+include relevant error messages from there with your bug report.
+
+For Apache 2.x the configuration link from /etc/apache2/conf.d must
+point to the /etc/torrus/torrus-apache2.conf file, provided by
+torrus-apache2 package.
+
+[2.1] /usr/share/doc/torrus-common/userguide.html
+
+======================================================================
+
+3. Why does it take forever to stop the Torrus daemons sometimes? 
+
+The recommended way to start and stop Torrus daemons is using the
+/etc/init.d/torrus-common script. It will start/stop the daemons for
+all trees which are configured. It uses a few parameters, which may be
+customized by setting the variables in the configuration file
+/etc/torrus/conf/initscript.siteconf. See the comment in this file
+for more information.
+
+======================================================================
+
+4. Where should I put my own XML templates and tree definitions?
+
+The configuration files which are meant to be edited to customize Torrus
+behavior are located in or under /etc/torrus directory:
+
+/etc/torrus/conf/torrus-siteconfig.pl
+/etc/torrus/conf/snmptrap-siteconfig.pl	
+/etc/torrus/conf/devdiscover-siteconfig.pl
+/etc/torrus/conf/email-siteconfig.pl
+/etc/torrus/xmlconfig/site-global.xml
+
+Your own XML tree definitions should be placed into /etc/torrus/xmlconfig,
+that's where 'torrus devdiscover' will place its output file by default.
+The directory /etc/torrus/discovery is provided for storage of the SNMP
+discovery files, generated by 'torrus genddx'.
+
+======================================================================
+
+5. File locations are completely different from the original
+   (non-Debian) Torrus installation. Why and where are the files now?
+
+To ensure compliance with Filesystem Hierarchy Standard (FHS) [5.1]
+required by the Debian Policy Manual [5.2], the Torrus directory locations
+on a Debian GNU/Linux system had to be chosen to be somewhat different
+from the defaults used by Torrus when installing from the distribution
+tarball.  By default Torrus installs its directory tree under /usr/local.
+The table below contains the new locations of the default Torrus
+directories (/u/l/ is short for /usr/local/).
+
+Old location		   New location(s)
+--------------------------------------------------------------------
+/u/l/torrus/bin		   /usr/sbin
+				torrus executable. This is a wrapper
+				script which may be used to invoke
+				any Torrus command. See 'man torrus'
+				for details.
+			   /usr/share/torrus/bin
+				Command scripts and action_* 
+				executables, which are designed to be
+				used from the monitor actions only.
+/u/l/etc/torrus		   /etc/torrus 
+				Configuration files.
+/u/l/torrus/examples	   /usr/share/doc/torrus-common/examples
+				Configuration and template examples.
+/u/l/torrus/doc		   /usr/share/doc/torrus-common
+				Documentation directory.
+/u/l/torrus/perllib	   /usr/share/perl5
+				Perl modules.
+/var/torrus/cache	   /var/cache/torrus
+/var/torrus/db		   /var/lib/torrus/db
+				BerkeleyDB files.
+/var/log/torrus		   /var/log/torrus
+				Log files.
+/var/run/torrus		   /var/run/torrus
+				Process ID (PID) file for Torrus daemons.
+/var/torrus/session_data   /var/lib/torrus/session_data
+				Session data storage and lock files.
+/srv/torrus/collector_rrd  /var/lib/torrus/collector_rrd
+				RRD data collector directory.
+
+[5.1] http://www.pathname.com/fhs/
+[5.2] http://www.debian.org/doc/debian-policy/
+
+======================================================================
+
+6. What other changes have been done to the original source?
+
+All the changes made to the original Torrus source are available in
+the form of the individual patches in the debian/patches directory of
+the torrus source package, which can be obtained using the command
+'apt-get source torrus'. Apart from modifying the directory layout,
+the following minor changes are worth mentioning:
+
+* The user documentation (except the developer documentation in [6.1] 
+  and the Torrus installation guide [6.2], irrelevant for Debian) has
+  been edited to reflect the new file locations.
+* The Torrus Debian package uses its own initialization script, placed in
+  /etc/init.d/torrus-common. It is based on the upstream's initialization
+  script but has been edited to include Debian-specific startup commands.
+
+[6.1] /usr/share/doc/torrus-common/devdoc
+[6.2] /usr/share/doc/torrus-common/install.*
+
+======================================================================
+
+7. "Cannot create BerkeleyDB Environment: DB_VERSION_MISMATCH"
+
+torrus-common depends on libberkeleydb-perl, which in turn depends on
+libdbX.X, whatever the current version is. If libberkeleydb-perl gets
+updated to a new version that depends on a new libdbX.X, torrus will
+not start and log "Cannot create BerkeleyDB Environment:
+DB_VERSION_MISMATCH: Database environment version mismatch".
+
+In this case, you need to recover your databases, for example by
+calling:
+
+dbX.X_recover -v -h /var/lib/torrus/db/
+
+======================================================================
+
+ -- Jurij Smakov <jurij@wooyd.org>  Wed,  4 May 2005 00:47:20 -0400
--- torrus-1.0.8.orig/debian/torrus-common.dirs
+++ torrus-1.0.8/debian/torrus-common.dirs
@@ -0,0 +1,2 @@
+var/lib/torrus/collector_rrd
+usr/share/doc/torrus-common/examples
--- torrus-1.0.8.orig/debian/TODO
+++ torrus-1.0.8/debian/TODO
@@ -0,0 +1,6 @@
+* Check torrus-common.README.Debian for inconsistencies.
+* Check what /usr/share/torrus/plugins subdirectories 
+  (devdiscover-config and torrus-config) are going to contain. They
+  might need to be moved to /usr/lib/torrus.
+* Regenerate the patches.
+* Figure out why variable substitution in manpages does not work.
--- torrus-1.0.8.orig/debian/torrus-apache2.conf
+++ torrus-1.0.8/debian/torrus-apache2.conf
@@ -0,0 +1,10 @@
+Alias /torrus/plain "/usr/share/torrus/sup/webplain"
+PerlRequire "/usr/share/torrus/conf_defaults/webmux2.pl"
+<Location /torrus>
+  SetHandler modperl
+  PerlResponseHandler Torrus::Apache2Handler
+</Location>
+<Location /torrus/plain/>
+  SetHandler default-handler
+  Options None
+</Location>
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.webintf
+++ torrus-1.0.8/debian/torrus-common.doc-base.webintf
@@ -0,0 +1,14 @@
+Document: torrus-webintf
+Title: Torrus Web Interface Reference
+Author: Stanislav Sinyagin
+Abstract: This document describes the Torrus configuration
+ options and settings controlling the appearance of generated
+ HTML pages and images.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/webintf.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/webintf.html
+Files: /usr/share/doc/torrus-common/webintf.html
--- torrus-1.0.8.orig/debian/torrus-common.init
+++ torrus-1.0.8/debian/torrus-common.init
@@ -0,0 +1,285 @@
+#!/bin/sh
+#
+# init.d script for Torrus
+#
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+### BEGIN INIT INFO
+# Provides:          torrus-collector torrus-monitor
+# Required-Start:    $local_fs $remote_fs $syslog $named $network $time
+# Required-Stop:     $local_fs $remote_fs $syslog $named $network
+# Should-Start:
+# Should-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Torrus collectors and monitors
+# Description:       Start/stop Torrus collectors and monitors
+### END INIT INFO
+
+set -e
+
+if [ -r "/lib/lsb/init-functions" ]; then
+  . /lib/lsb/init-functions
+else
+  echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed"
+  exit 1
+fi
+
+# this is from madduck on IRC, 2006-07-06
+# There should be a better possibility to give daemon error messages
+# and/or to log things
+log()
+{
+  case "$1" in
+    [[:digit:]]*) success=$1; shift;;
+    *) :;;
+  esac
+  log_action_begin_msg "$1"; shift
+  log_action_end_msg ${success:-0} "$*"
+}
+
+sysconfdir=/home/mh/torrus/build-area/torrus-1.0.6/debian/tmp/etc
+cmddir=/usr/share/torrus/bin
+piddir=/var/run/torrus
+sitedir=/etc/torrus
+torrus_config_pl=/usr/share/torrus/conf_defaults/torrus-config.pl
+
+. /usr/share/torrus/conf_defaults/initscript.conf
+if test -f ${sitedir}/conf/initscript.siteconf; then
+  . ${sitedir}/conf/initscript.siteconf
+fi
+
+if test "$TORRUS_CHANGE_UID" = yes -a \
+        "${LOGNAME:-root}" = root -a \
+        "/bin/su" != "no"; then
+  user=Debian-torrus
+  su="/bin/su ${user} -c"
+else
+  su="/bin/bash -c"
+fi
+
+# Second argument can be the daemon name
+if test x"$2" = x; then
+  daemons="collector monitor"
+  monitor_cmdopts="$TORRUS_MONITOR_DELAY"
+else
+  daemons=$2
+  # Third and fourth arguments may be the tree name and instance
+  if test x"$3" != x -a x"$4" != x; then
+    eval trees_${daemons}=$3
+    eval col_inst_${3}=$4
+    read_treenames=no
+  fi
+fi
+
+if test x"$TORRUS_COLLECTOR_CMDOPTS" != x; then
+  collector_cmdopts="$TORRUS_COLLECTOR_CMDOPTS"
+fi
+
+if test x${read_treenames} != xno; then
+
+  # Get the names of the trees for each daemon
+  for d in ${daemons}; do
+    eval trees_${d}=\"`/usr/bin/perl -e 'require "'$torrus_config_pl'";
+    while((my $key, $val) = each %Torrus::Global::treeConfig) {
+      print "$key " if $val->{run}{'${d}'};
+    };'`\"
+  done
+
+  # Get the collector instance numbers for each tree
+  eval trees=\"\$\{trees_collector\}\"
+  for t in ${trees}; do
+    eval col_inst_${t}=\"`/usr/bin/perl -e 'require "'$torrus_config_pl'";
+    print join(" ",
+    (0 .. $Torrus::Global::treeConfig{'${t}'}{run}{collector}-1))'`\"
+  done
+fi
+
+start_daemons () {
+  for d in ${daemons}; do
+    eval trees=\"\$\{trees_${d}\}\"
+    eval daemon_cmdopts=\"\$\{${d}_cmdopts\}\"
+
+    # /var/run might be a tmpfs, recreate the pid directory if necessary
+    if ! test -d ${piddir} ; then
+      mkdir -p ${piddir}
+      test "${user}" && chown ${user} ${piddir}
+    fi
+
+    for t in ${trees}; do
+      if test ${d} = collector; then
+        eval instances=\"\$\{col_inst_${t}\}\"
+	for i in ${instances}; do
+          if pidofproc -p "${piddir}/${d}.${t}_${i}.pid" > /dev/null; then
+            log_progress_msg "${d} (${i} ${t}) already running"
+	  else
+            log_progress_msg "${d} (${i} ${t})"
+	    # we cannot use start_daemon here since its specification does not
+	    # include --chuid, which we need.
+            start-stop-daemon --start --quiet \
+	                  --chuid "Debian-torrus:Debian-torrus" \
+	                  --exec "${cmddir}/${d}" \
+	                  --pidfile "${piddir}/${d}.${t}_${i}.pid" \
+	                  -- --tree="${t}" --instance=${i} \
+			     ${daemon_cmdopts} ${TORRUS_CMDOPTS}
+	  fi
+	done
+      else
+        if pidofproc -p "${piddir}/${d}.${t}.pid" > /dev/null; then
+          log_progress_msg "${d} (${t}) already running"
+        else
+          log_progress_msg "${d} (${t} ${daemon_cmdopts})"
+          start-stop-daemon --start --quiet \
+	                  --chuid "Debian-torrus:Debian-torrus" \
+	                  --exec "${cmddir}/${d}" \
+	                  --pidfile "${piddir}/${d}.${t}.pid" \
+	                  -- --tree="${t}" \
+			     ${daemon_cmdopts} ${TORRUS_CMDOPTS}
+	fi
+      fi
+    done
+  done
+}
+
+daemon_status () {
+  RET=3
+  for d in ${daemons}; do
+    eval trees=\"\$\{trees_${d}\}\"
+
+    for t in ${trees}; do
+      eval instances=\"\$\{col_inst_${t}\}\"
+      for i in ${instances}; do
+        log_action_begin_msg "Checking ${d} (${i} ${t})"
+        if pidofproc -p "${piddir}/${d}.${t}_${i}.pid" > /dev/null; then
+          log_action_end_msg 0 "running"
+	  if [ "$RET" -eq "3" ]; then
+	    RET=0
+	  fi
+        else
+          if [ -e "${piddir}/${d}.${t}_${i}.pid" ]; then
+            log_action_end_msg 0 "${d} (${i} ${t}) failed"
+	    RET=1
+          else
+            log_action_end_msg 0 "not running"
+          fi
+        fi
+      done
+    done
+  done
+  return $RET
+}
+
+stop_daemons () {
+  tokill=""
+  for d in ${daemons}; do
+    eval trees=\"\$\{trees_${d}\}\"
+    for t in ${trees}; do
+      if test ${d} = collector; then
+        eval instances=\"\$\{col_inst_${t}\}\"
+	
+	for i in ${instances}; do
+          pidfile="${piddir}/${d}.${t}_${i}.pid"
+          if test -r "${pidfile}"; then
+            tokill=${tokill}' t='${t}'_'${i}';d='${d}
+	    log_action_cont_msg "TERM ${d} (${i} ${t})"
+	    killproc -p "${pidfile}" $d TERM
+	  fi
+        done
+      else
+        pidfile="${piddir}/${d}.${t}.pid"
+        if test -r "${pidfile}"; then
+          tokill=${tokill}' t='${t}';d='${d}
+	  log_action_cont_msg "TERM ${d} (${t})"
+	  killproc -p "${pidfile}" $d TERM
+	fi
+      fi
+    done
+  done
+  
+  killed=$(echo "${tokill}" | wc -w)
+  notdead=1
+  kc=${TORRUS_KILL_COUNT}
+  while test $killed -gt 0 -a $kc -gt 0; do
+    log_action_cont_msg "sleep"
+    /bin/sleep $TORRUS_KILL_SLEEP
+    kc=$(expr $kc - 1)
+    for tuple in ${tokill}; do
+      eval ${tuple}
+      pidfile="${piddir}/${d}.${t}.pid"
+      if test -r "${pidfile}"; then
+	log_action_cont_msg "TERM ${d} (${t})"
+	killproc -p "${pidfile}" $d TERM
+      else
+        killed=$(expr $killed - 1)
+      fi
+    done
+  done
+
+  if test \( $killed -gt 0 \); then
+   for tuple in $tokill; do
+     eval $tuple
+     pidfile="${piddir}/${d}.${t}.pid"
+     if test -r "${pidfile}"; then
+       log_action_cont_msg "KILL ${d} (${t})"
+       killproc -p "${pidfile}" $d KILL
+     fi
+   done
+  fi
+}
+
+restart_apache () {
+  for apachedir in apache2
+  do
+    if test -L /etc/${apachedir}/conf.d/torrus-apache2.conf; then
+       test -x /etc/init.d/${apachedir} && invoke-rc.d ${apachedir} restart
+    fi
+  done
+}
+
+clear_cache () {
+  if test -x /usr/sbin/torrus ; then
+    /usr/sbin/torrus clearcache > /dev/null 2>&1 || true
+  fi
+}
+
+case "$1" in
+  start)
+    log_progress_msg "Starting Torrus daemons:" ""
+    start_daemons
+    log_end_msg 0
+  ;;
+  stop)
+    log_action_begin_msg "Stopping Torrus daemons (this may take a while)"
+    stop_daemons
+    log_end_msg 0
+  ;;
+  restart)
+    log_action_begin_msg "Stopping Torrus daemons for restart (this may take a while)..."
+    stop_daemons
+    log_end_msg 0
+    log_progress_msg "Restarting Torrus daemons" ""
+    start_daemons
+    log_end_msg 0
+  ;;
+  force-reload) 
+    log_action_begin_msg "Stopping Torrus daemons for restart (this may take a while)..."
+    stop_daemons
+    log_end_msg 0
+    log_action_begin_msg "Clearing Torrus cache"
+    clear_cache
+    log_end_msg 0
+    log "Restarting apache web server"
+    restart_apache
+    log_progress_msg "Restarting Torrus daemons" ""
+    start_daemons
+    log_end_msg 0
+  ;;
+  status)
+    daemon_status
+  ;;
+  *)  echo "Usage: $0 {start|stop|restart|force-reload|status}"
+      exit 1
+  ;;
+esac
+
+exit 0
--- torrus-1.0.8.orig/debian/torrus-db-recover
+++ torrus-1.0.8/debian/torrus-db-recover
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+#
+# Copyright (C) 2008 Joerg Dorchain <joerg@dorchain.net>
+#
+# recover a torrus-db in case of BerkeleyDB upgrades
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+require '/usr/share/torrus/conf_defaults/torrus-config.pl';
+
+use strict;
+use BerkeleyDB;
+
+if ( not -d $Torrus::Global::dbHome ) { die "No such directory: $Torrus::Global::dbHome"; }
+
+my $env = new BerkeleyDB::Env( -Home  => $Torrus::Global::dbHome,
+		-Flags => (DB_CREATE | DB_RECOVER | DB_INIT_TXN | DB_INIT_LOCK),
+		-Mode  => 0664, -ErrFile => *STDERR, -Verbose => 1 );
+if( not defined($env) ) { die "Cannot create BerkeleyDB Environment: ".$BerkeleyDB::Error; }
+
+# Use it only when it is implemented - checked with BerkeleyDB 0.34
+# BerkeleyDB::env_remove (-Home  => $Torrus::Global::dbHome);
+print "Recovery of $Torrus::Global::dbHome sucessful\n";
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.scalability
+++ torrus-1.0.8/debian/torrus-common.doc-base.scalability
@@ -0,0 +1,14 @@
+Document: torrus-scalability
+Title: Torrus Scalability Guide
+Author: Stanislav Sinyagin, Christian Schnidrig
+Abstract: Tips and tricks for Torrus installation in a 
+ big enterprise or carrier network environment, ensuring
+ its reliable and efficient operation.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/scalability.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/scalability.html
+Files: /usr/share/doc/torrus-common/scalability.html
--- torrus-1.0.8.orig/debian/torrus-common.cron.daily
+++ torrus-1.0.8/debian/torrus-common.cron.daily
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+[ -x /usr/sbin/torrus ] && /usr/sbin/torrus cleanup
+[ -x /usr/share/torrus/scripts/rrdup_notify ] && /usr/share/torrus/scripts/rrdup_notify
+
+exit 0
+
+# end of file
--- torrus-1.0.8.orig/debian/copyright
+++ torrus-1.0.8/debian/copyright
@@ -0,0 +1,93 @@
+This is Torrus (Round Robin Database Frawork), packaged for Debian
+GNU/Linux by Jurij Smakov <jurij@wooyd.org> on July 1st, 2004. The
+original source was downloaded from 
+
+http://sourceforge.net/projects/torrus/
+
+Torrus is Copyright (C) 2002-2005 Stanislav Sinyagin <ssinyagin@yahoo.com>,
+with the following exceptions:
+
+doc/stylingprofile.pod.in,
+doc/devdoc/devdiscover.pod,
+perllib/Torrus/DevDiscover/CompaqCIM.pm,
+perrlib/Torrus/DevDiscover/EmpireSystemedge.pm,
+perrlib/Torrus/DevDiscover/F5BigIp.pm,
+perrlib/Torrus/DevDiscover/NetApp.pm,
+perrlib/Torrus/DevDiscover/NetScreen.pm,
+perrlib/Torrus/DevDiscover/OracleDatabase.pm,
+perrlib/Torrus/DevDiscover/RFC1697_RDBMS.pm,
+perrlib/Torrus/DevDiscover/UcdSnmp.pm,
+sup/styling/rainbow-schema.pl,
+sup/styling/torrus-schema.pl,
+examples/xmlconfig/rainbow-schema.xml,
+examples/xmlconfig/generic/collector-periods.xml,
+examples/xmlconfig/generic/monitors.xml,
+examples/xmlconfig/old/rfc1213.xml,
+xmlconfig/vendor/cisco.firewall.xml,
+xmlconfig/vendor/compaq.cim.xml,
+xmlconfig/vendor/empire.systemedge.ntregperf.xml,
+xmlconfig/vendor/empire.systemedge.xml,
+xmlconfig/vendor/f5.bigip.xml,
+xmlconfig/vendor/microsoft.windows.xml,
+xmlconfig/vendor/netapp.filer.xml,
+xmlconfig/vendor/netscreen.xml,
+xmlconfig/vendor/smokeping.xml,
+xmlconfig/vendor/ucd.ucd-snmp.xml:
+	Copyright (C) 2003 Shawn Ferry <sferry at sevenspace dot com>
+perrlib/Torrus/DevDiscover/MicrosoftWindows.pm,
+perrlib/Torrus/DevDiscover/RFC2790_HOST_RESOURCES.pm,
+sup/styling/colornames.pl,
+examples/xmlconfig/generic/rfc2790.host-resources.xml:
+	Portions Copyright (C) 2003 Shawn Ferry <sferry at sevenspace dot com>
+xmlconfig/examples/server.data,
+xmlconfig/examples/server.tmpl:
+	Copyright (C) 2003 Christian Schnidrig
+bin/schedulerinfo.in,
+doc/scalability.pod.in:
+	Portions Copyright (C) 2004 Christian Schnidrig
+xmlconfig/examples/ascend.max.xml,
+examples/xmlconfig/generic/rfc2670.docsis-if.xml,
+examples/xmlconfig/old/rfc2670.docsis-if.old.0.1.5d-20040224.xml,
+xmlconfig/vendor/ascend.max.xml,
+xmlconfig/vendor/cisco.ios.docsis.xml:
+	Portions Copyright (C) 2003 Roman Hochuli
+perllib/Torrus/DevDiscover/BetterNetworks.pm,
+xmlconfig/vendor/betternetworks.xml:
+	Portions Copyright (C) 2004 Marc Haber
+examples/onmsInterfaces.sh:	
+	Portions Copyright (C) 2004 Gustavo Torres
+perllib/Torrus/Log.pm,
+perrlib/Torrus/RPN.pm:
+	Portions Copyright (C) 1998 Jeff R. Allen and WebTV Networks, Inc.
+perllib/Torrus/DevDiscover/ATMEL.pm,
+xmlconfig/vendor/atmel.xml:
+	Copyright (C) 2004 Scott Brooks
+sup/webplain/torrus.css:
+	Portions Copyright BlueRobot.com
+	Portions Copyright Ian Holsman <ian@holsman.net>
+xmlconfig/examples/apc-ups.xml,
+xmlconfig/vendor/apc.ups.xml,
+xmlconfig/vendor/hp.hpux.xml:
+	Portions Copyright (C) 2003 Aaron S. Bush <abush at microelectronics dot com>
+examples/xmlconfig/generic/rfc2662.adsl-line.xml,
+xmlconfig/vendor/paradyne.xdsl.xml:
+	Portions Copyright (C) 2003 Gord Philpott <gphilpot@mnsi.net>
+
+Torrus is distributed under the following terms:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+The full text of the GNU General Public Licence is also available on
+any Debian installation as /usr/share/common-licenses/GPL.
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.snmpdiscovery
+++ torrus-1.0.8/debian/torrus-common.doc-base.snmpdiscovery
@@ -0,0 +1,13 @@
+Document: torrus-snmpdiscovery
+Title: Torrus SNMP Discovery User Guide
+Author: Stanislav Sinyagin
+Abstract: The guide to the Torrus tools for performing
+ Simple Network Management Protocol (SNMP) device discovery.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/snmpdiscovery.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/snmpdiscovery.html
+Files: /usr/share/doc/torrus-common/snmpdiscovery.html
--- torrus-1.0.8.orig/debian/torrus-apache2.links
+++ torrus-1.0.8/debian/torrus-apache2.links
@@ -0,0 +1 @@
+usr/share/doc/torrus-common	usr/share/doc/torrus-apache2
--- torrus-1.0.8.orig/debian/torrus-common.install
+++ torrus-1.0.8/debian/torrus-common.install
@@ -0,0 +1,8 @@
+debian/tmp/usr
+debian/tmp/var
+debian/tmp/etc
+debian/html/*.html /usr/share/doc/torrus-common
+debian/html/devdoc/*.html /usr/share/doc/torrus-common/devdoc
+debian/bug/torrus-common/* /usr/share/bug/torrus-common
+debian/initscript.siteconf /etc/torrus/conf
+debian/lintian/overrides/torrus-common usr/share/lintian/overrides
--- torrus-1.0.8.orig/debian/watch
+++ torrus-1.0.8/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://sf.net/torrus/torrus-(.+)\.tar\.gz
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.userguide
+++ torrus-1.0.8/debian/torrus-common.doc-base.userguide
@@ -0,0 +1,13 @@
+Document: torrus-userguide
+Title: Torrus User Guide
+Author: Stanislav Sinyagin
+Abstract: Primary source of information about Torrus configuration
+ and operation.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/userguide.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/userguide.html
+Files: /usr/share/doc/torrus-common/userguide.html
--- torrus-1.0.8.orig/debian/torrus-common.logrotate
+++ torrus-1.0.8/debian/torrus-common.logrotate
@@ -0,0 +1,33 @@
+/var/log/torrus/*.log {
+	weekly
+	missingok
+	rotate 8
+	compress
+	delaycompress
+	notifempty
+	create 640 Debian-torrus Debian-torrus
+	sharedscripts
+	postrotate
+		for i in $(find /var/run/torrus -name 'collector.*.pid' -or \
+		                                -name 'monitor.*.pid')
+		do
+		  kill -s HUP $(cat ${i})
+		done
+	endscript
+}
+
+/var/log/torrus/dbenv_errlog* {
+        monthly
+        missingok
+        rotate 0
+        maxage 90
+        ifempty
+        sharedscripts
+        postrotate
+                for i in $(find /var/run/torrus -name 'collector.*.pid' -or \
+                                                -name 'monitor.*.pid')
+                do
+                  kill -s HUP $(cat ${i})
+                done
+        endscript
+}
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.vendorsupport
+++ torrus-1.0.8/debian/torrus-common.doc-base.vendorsupport
@@ -0,0 +1,16 @@
+Document: torrus-vendorsupport
+Title: Torrus Vendor Support List
+Author: Stanislav Sinyagin
+Abstract: This document provides a list of vendor devices
+ and generic MIBs (Management Information Bases) that are
+ supported by Torrus SNMP (Simple Network Management
+ Protocol) discovery utilities and/or templates and other
+ supporting files.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/vendorsupport.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/vendorsupport.html
+Files: /usr/share/doc/torrus-common/vendorsupport.html
--- torrus-1.0.8.orig/debian/torrus-apache2.postrm
+++ torrus-1.0.8/debian/torrus-apache2.postrm
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+# Remove links on purge
+if test "${1}" = "purge"; then
+    if test -L /etc/apache2/conf.d/torrus-apache2.conf ; then
+	rm -f /etc/apache2/conf.d/torrus-apache2.conf || true
+        if [ -x "$(which invoke-rc.d 2>/dev/null)" ]; then
+            invoke-rc.d apache2 reload > /dev/null 2>&1 || true
+        else
+            /etc/init.d/apache2 reload > /dev/null 2>&1 || true
+        fi
+    fi
+fi
+
+#DEBHELPER#
+
+exit 0
--- torrus-1.0.8.orig/debian/torrus-apache.postrm
+++ torrus-1.0.8/debian/torrus-apache.postrm
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+if [ "$1" = "purge" ] ; then
+    rm -f /etc/torrus/torrus-apache.conf /etc/apache/conf.d/torrus-apache.conf
+fi
+
+#DEBHELPER#
+
+exit 0
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.stylingprofile
+++ torrus-1.0.8/debian/torrus-common.doc-base.stylingprofile
@@ -0,0 +1,14 @@
+Document: torrus-stylingprofile
+Title: Torrus Styling Profile Guide
+Author: Shawn Ferry
+Abstract: The guide to customization of the Torrus graphical
+ user interface by definining, modifying, extending and
+ overriding the style templates.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/stylingprofile.txt.gz
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/stylingprofile.html
+Files: /usr/share/doc/torrus-common/stylingprofile.html
--- torrus-1.0.8.orig/debian/control
+++ torrus-1.0.8/debian/control
@@ -0,0 +1,59 @@
+Source: torrus
+Section: net
+Priority: extra
+Maintainer: Torrus maintainers <pkg-torrus-maintainers@lists.alioth.debian.org>
+Uploaders: Marc Haber <mh+debian-packages@zugschlus.de>, Jurij Smakov <jurij@debian.org>, Christoph Berg <myon@debian.org>
+Standards-Version: 3.8.4
+Build-Depends: debhelper (>= 5), dpatch, autotools-dev
+Build-Depends-Indep: libtemplate-perl (>= 2.10), librrds-perl
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-torrus
+Vcs-Svn: svn://svn.debian.org/svn/pkg-torrus/trunk
+Homepage: http://torrus.org/
+
+Package: torrus-apache
+Architecture: all
+Depends: ${misc:Depends}, torrus-apache2, torrus-common (= ${source:Version})
+Description: Transitional Package for migration to torrus-apache2
+ This is a transitional package which can be safely removed.
+
+Package: torrus-apache2
+Architecture: all
+Depends: ${misc:Depends}, torrus-common (= ${source:Version}), apache2-mpm-prefork | apache2, libapache2-mod-perl2 (>= 2.0.0), libapache2-request-perl (>= 2.05-dev-6)
+Conflicts: apache2-mpm-worker, apache2-mpm-event
+Description: Universal front-end for Round-Robin Databases (for apache 2.x)
+ Installs torrus-common and configures it for operation together with
+ the Apache 2.x web server. Apache 2.x will be restarted during
+ installation of torrus-apache2.
+ .
+ Torrus is designed to be a universal front-end framework for
+ Round-Robin Databases using Tobias Oetiker's RRDtool. It may be configured
+ to collect and monitor arbitrary data series from various data
+ sources which can in turn be displayed on a web page served by the
+ Apache web server.
+ .
+ One of the traditional applications of this functionality is the collection
+ and visualization of network information using the Simple Network Management
+ Protocol (SNMP) from SNMP-enabled devices.
+ .
+ Torrus has been formerly known as rrfw, round-robin database framework.
+
+Package: torrus-common
+Architecture: all
+Depends: ${misc:Depends}, netbase, rrdtool, perl (>= 5.8.1), librrds-perl, libberkeleydb-perl (>= 0.25-2), libxml-libxml-perl (>= 1.56), libproc-daemon-perl, libnet-snmp-perl (>= 4.0.3), libapache-session-perl, libtemplate-perl (>= 2.10), libtimedate-perl, adduser, lsb-base (>= 3.0-6)
+Description: Universal front-end for Round-Robin Databases (common files)
+ Core part of the Torrus suite, providing support files needed by the
+ other Torrus packages. It is not meant to be installed directly.
+ Instead, use torrus-apache2, which will install and configure Torrus for
+ operation together with Apache 2.x web server.
+ .
+ Torrus is designed to be a universal front-end framework for
+ Round-Robin Databases using Tobias Oetiker's RRDtool. It may be configured
+ to collect and monitor arbitrary data series from various data
+ sources which can in turn be displayed on a web page served by the
+ Apache web server.
+ .
+ One of the traditional applications of this functionality is the collection
+ and visualization of network information using the Simple Network Management
+ Protocol (SNMP) from SNMP-enabled devices.
+ .
+ Torrus has been formerly known as rrfw, round-robin database framework.
--- torrus-1.0.8.orig/debian/torrus-common.doc-base.rpnexpr
+++ torrus-1.0.8/debian/torrus-common.doc-base.rpnexpr
@@ -0,0 +1,14 @@
+Document: torrus-rpnexpr
+Title: RPN expressions in Torrus
+Author: Stanislav Sinyagin
+Abstract: This guide documents Torrus extensions to the RRDtool's
+ RPN (Reverse Polish Notation) expressions. RPN expressions are
+ used to manipulate the data collected by Torrus.
+Section: Network/Monitoring
+
+Format: text
+Files: /usr/share/doc/torrus-common/rpnexpr.txt
+
+Format: HTML
+Index: /usr/share/doc/torrus-common/rpnexpr.html
+Files: /usr/share/doc/torrus-common/rpnexpr.html
--- torrus-1.0.8.orig/debian/rules
+++ torrus-1.0.8/debian/rules
@@ -0,0 +1,126 @@
+#!/usr/bin/make -f
+include /usr/share/dpatch/dpatch.make
+
+# Variables for get_orig_source 
+
+base_url = http://unc.dl.sourceforge.net/sourceforge/torrus/
+release_name = torrus-1.0.0 
+release_tarball = $(addsuffix .tar.gz, $(release_name))
+
+tmpdir = $(shell pwd)/debian/tmp
+
+clean: clean-patched unpatch
+
+clean-patched:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp config.sub config.guess
+	rm -f doc/*.txt
+	dh_clean
+	cd debian/html && $(MAKE) clean
+	test -f Makefile && $(MAKE) distclean || true
+
+binary: binary-indep binary-arch
+
+binary-arch: build
+
+binary-indep: build install
+
+build: patch build-stamp
+
+build-stamp:
+	dh_testdir
+	ln -sf /usr/share/misc/config.sub .
+	ln -sf /usr/share/misc/config.guess .
+	rm -f config.cache
+	pkghome=$(tmpdir)/usr/share \
+	varprefix=$(tmpdir)/var/lib/torrus \
+	cachedir=$(tmpdir)/var/cache/torrus \
+	piddir=$(tmpdir)/var/run/torrus \
+	logdir=$(tmpdir)/var/log/torrus \
+	pkgbindir=$(tmpdir)/usr/share/torrus/bin \
+	wrapperdir=$(tmpdir)/usr/sbin \
+	cfgdefdir=$(tmpdir)/usr/share/torrus/conf_defaults \
+	pkgdocdir=$(tmpdir)/usr/share/doc/torrus-common \
+	exmpdir=$(tmpdir)/usr/share/doc/torrus-common/examples \
+	perllibdir=$(tmpdir)/usr/share/perl5 \
+	pluginsdir=$(tmpdir)/usr/share/torrus/plugins \
+	scriptsdir=$(tmpdir)/usr/share/torrus/scripts \
+	supdir=$(tmpdir)/usr/share/torrus/sup \
+	tmpldir=$(tmpdir)/usr/share/torrus/templates \
+	distxmldir=$(tmpdir)/usr/share/torrus/xmlconfig \
+	defrrddir=$(tmpdir)/var/lib/torrus/collector_rrd \
+	mansec_usercmd=8 \
+	./configure --datadir=$(tmpdir)/usr/share/torrus \
+		    --sysconfdir=$(tmpdir)/etc \
+		    --sharedstatedir=$(tmpdir)/var/lib/torrus \
+		    --localstatedir=$(tmpdir)/var/lib/torrus \
+		    --libdir=$(tmpdir)/usr/share/torrus/lib \
+		    --mandir=$(tmpdir)/usr/share/man \
+		    --enable-pkgonly \
+		    --disable-varperm	
+	sed -e 's,$(tmpdir),,' setup_tools/substvars.sh > substvars.tmp
+	mv substvars.tmp setup_tools/substvars.sh
+	sed -e 's,$(tmpdir),,' configs/instvars > instvars.tmp
+	mv instvars.tmp configs/instvars
+	chmod +x setup_tools/substvars.sh
+	$(MAKE)
+#	Build the html documentation
+	cd debian/html && $(MAKE)
+	touch build-stamp
+
+install: build
+	dh_testdir
+	dh_testroot
+	$(MAKE) install
+	dh_installdirs
+	dh_installinit
+	dh_installdocs -ptorrus-common
+	dh_installchangelogs -ptorrus-common ChangeLog
+	dh_installlogrotate
+	dh_installcron
+	dh_installman
+	dh_install -A 
+#	Delete duplicate entries
+	rm -f  debian/torrus-common/usr/sbin/torrus_action_*
+#	Delete the documentation in .pod format
+	rm -f  debian/torrus-common/usr/share/doc/torrus-common/*.pod
+	rm -f  debian/torrus-common/usr/share/doc/torrus-common/devdoc/*.pod
+#	Rename example script
+	mv debian/torrus-common/usr/share/torrus/scripts/rrdup_notify.sh \
+	   debian/torrus-common/usr/share/torrus/scripts/rrdup_notify
+	chmod 755 debian/torrus-common/usr/share/torrus/scripts/rrdup_notify
+#	/var/run/torrus is created by the init script
+	rmdir debian/torrus-common/var/run/torrus debian/torrus-common/var/run
+	dh_installdeb
+	dh_fixperms -A
+	dh_compress
+	dh_link -A
+	dh_md5sums -A
+	dh_gencontrol -A
+	dh_builddeb -A
+
+# Optional rules
+
+build-setup: $(release_tarball)
+	dh_testdir
+	# A hack to get the source extracted into the current dir
+	ln -s . $(release_name)
+	tar xzf $(release_tarball)
+	rm -f $(release_name)
+	
+build-clean:
+	dh_testdir
+	debian/rules clean
+	find -mindepth 1 -maxdepth 1 \
+	     -not -name '$(release_tarball)' \
+	     -not -name 'debian' -print0 | \
+	     xargs --null --no-run-if-empty rm -rf 
+	find \( -name config.sub -o -name config.guess \) -print0 | \
+	     xargs --null --no-run-if-empty rm -f
+
+$(release_tarball):
+	dh_testdir
+	wget $(base_url)$(release_tarball)
+
+.PHONY: build clean binary-indep binary-arch binary install build-setup build-clean
--- torrus-1.0.8.orig/debian/compat
+++ torrus-1.0.8/debian/compat
@@ -0,0 +1 @@
+5
--- torrus-1.0.8.orig/debian/changelog
+++ torrus-1.0.8/debian/changelog
@@ -0,0 +1,200 @@
+torrus (1.0.8-2) unstable; urgency=low
+
+  [ Marc Haber ]
+  * Make torrus conflict with apache2-mpm-worker and apache2-mpm-event.
+    Thanks to Stanislav Sinyagin. Closes: #571139
+  * Add logrotate stanza for dbenv_errlog.
+    Thanks to Jörg Dorchain. Closes: #497031
+  * make lintian happy
+    * fix typo in doc-base file
+    * Standards-Version: 3.8.4 (no changes necessary)
+    * add debian/README.Source
+    * add ${misc:Depends} to binary Depends
+    * update autotools helper files (code from
+      /usr/share/doc/autotools-dev/examples/rules.gz)
+    * build-depend on autotools-dev
+
+  [ Christoph Berg ]
+  * Use dh_md5sums.
+
+ -- Christoph Berg <myon@debian.org>  Fri, 26 Mar 2010 11:09:41 +0100
+
+torrus (1.0.8-1) unstable; urgency=low
+
+  [ Marc Haber ]
+  * Fix wrong logic in /lib/lsb/init-functions processing.
+  * Document the need to db_recover after libberkeleydb-perl update.
+    Thanks to Jörg Dorchain. This partly addresses #476356
+
+  [ Christoph Berg ]
+  * New upstream version 1.0.8. Closes: #497502
+  * Adding myself as Uploader, thanks Marc. Closes: #433223
+  * Create /var/run/ from init script instead of shipping it in the deb.
+  * Use invoke-rc.d in init script.
+  * Maintainer scripts use -e, call apache2ctl without explicit path.
+  * Update doc-base section to Network/Monitoring.
+  * Bumping to DH level 5, and Standards-Version to 3.8.1.
+  * Adding Homepage and Vcs control headers and watch file.
+
+ -- Christoph Berg <myon@debian.org>  Thu, 14 May 2009 16:33:08 +0200
+
+torrus (1.0.6-2) unstable; urgency=low
+
+  * Add torrus-common.NEWS advising people to recompile their
+    configuration upon upgrading to torrus 1.0.6.
+    Thanks to Joerg Dorchain. Closes: #469274
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat, 08 Mar 2008 00:18:46 +0100
+
+torrus (1.0.6-1) unstable; urgency=low
+
+  * New upstream version
+  * Remove torrus-apache conffiles on torrus-apache purge.
+    Thanks to Kumar Appaiah and the piuparts team. Closes: #454389
+  * Init script:
+    * add LSB Headers
+    * adapt semantics to LSB, output and status target. Closes: #377033
+  * Make lintian happy
+    * Add overrides for empty /usr/share directories
+    * Add descriptions to our dpatches
+    * Standards-Version: 3.7.3 (no changes necessary)
+  * Streamline patch names
+  * allow rrdup_notify to be configured from /etc/default/torrus-common,
+    install rrdup_notify to /usr/share/torrus, invoke from cron.daily.
+    Closes: #380625
+  * torrus-apache2.postinst: give a more meaningful error message if
+    apache2ctl configtest fails
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat, 16 Feb 2008 21:36:01 +0100
+
+torrus (1.0.5-2) unstable; urgency=low
+
+  * Check for /usr/sbin/torrus in cron job.
+    Thanks to Filippo Giunchedi. Closes: #436021
+  * Remove doc/*.txt in the clean target to get *.pod files
+    regenerated correctly on second and subsequent builds.
+    Closes: #441729
+
+ -- Jurij Smakov <jurij@debian.org>  Sat, 15 Sep 2007 18:34:10 +0100
+
+torrus (1.0.5-1) unstable; urgency=low
+
+  * New upstream release. Closes: #409206
+  * remove apache support. Closes: #429070
+  * Mailing list as Maintainer. We're looking for help! See #433223
+  * Update debian/patches/03-doc-userguide.dpatch, so that it
+    applies cleanly to the new version.
+  * README.Debian: apache/conf.d is in fact apache2/conf.d.
+    Thanks to Christopher Huhn. Closes: #407448
+  * Use Source:Version instead of Source-Version.
+  * Remove gratuitous -ptorrus-common parameters
+  * debian/rules: replace docdir with pkgdocdir in configure call.
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat, 28 Jul 2007 22:53:30 +0200
+
+torrus (1.0.4-1) unstable; urgency=low
+
+  [ Upstream changes relevant for Debian ]
+  * New upstream release.
+
+  [ Jurij Smakov ]
+  * Expand the copyright file to include the information about all
+    authors and copyright holders.
+  * Use invoke-rc.d instead of invoking the init script directly
+    in maintainer scripts.
+
+  [ Marc Haber ]
+  * Standards-Version: 3.7.2 (no changes needed)
+  * Move debhelper and dpatch to Build-Depends.
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Mon, 24 Jul 2006 13:08:45 +0000
+
+torrus (1.0.3-1) unstable; urgency=low
+
+  [ Upstream changes relevant for Debian ]
+  * New upstream release.
+
+  [ Jurij Smakov ]
+  * Removed dependency of torrus-apache2 on libapache2-mod-apreq2, 
+    which is normally pulled in by libapache2-request-perl, but due
+    to a bug in the latter (#319614) that was not happening, so an
+    explicit dep was required. Thanks to Steinar H. Gunderson for
+    clarification.
+  * Added a version (>= 2.05-dev-6) to the libapache2-request-perl
+    to guarantee that we have the version in which the above bug is
+    fixed, and ensure that the version of libapreq2 (on which 
+    libapache2-request-perl depends) is at least 2.05, as required
+    by upstream.
+
+ -- Jurij Smakov <jurij@wooyd.org>  Wed,  3 Aug 2005 20:02:19 -0400
+
+torrus (1.0.2-1) unstable; urgency=low
+
+  [ Upstream changes relevant for Debian ]
+  * New upstream release.
+  * Fixed Apache2 support, broken by mod_perl2 API change. Minimum
+    supported mod_perl2 version is now 2.0.0.
+    Closes: #318847
+  * Fixed the breakage caused by removal of the cache files in
+    /var/cache/torrus. The absence of cache files is now detected
+    and they are regenerated on the fly, in compliance with FHS.
+    Closes: #318892
+
+  [ Marc Haber ]
+  * Removed "unreleased" warnings from debian/control. duh.
+
+  [ Jurij Smakov ]
+  * Included the description of a new TORRUS_COLLECTOR_CMDOPTS
+    variable in /etc/torrus/initscript.siteconf and updated
+    the init script to honour it.
+  * Bumped Standards-Version to 3.6.2.
+  * As per new policy recommendation, all user documentation
+    (except migration and installation guides, which are irrelevant
+    for Debian) is now registered with doc-base.
+  * New dependency on libtimedate-perl which provides Date::Parse
+    and Date::Format, per upstream requirement.
+  * Bumped the minimum version of libapache2-mod-perl2 providing
+    mod_perl2 to 2.0.0 per upstream requirement.
+  * Removed dependencies on adduser for torrus-apache and
+    torrus-apache2 and added it to torrus-common, since adduser is
+    only used in torrus-common postinst.
+  * Added --no-create-home option to adduser call in torrus-common
+    postinst.
+  * Added dependency on libapache2-mod-apreq2 for torrus-apache2
+    since it provides the Apache2 module, earlier shipped as a
+    part of libapreq2 package.
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat, 30 Jul 2005 18:53:20 +0000
+
+torrus (1.0.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Move init script defaults to /etc/torrus/conf/initscript.siteconf,
+    getting the package in line with upstream. For compatibility, we
+    symlink to /etc/default/torrus-common.
+    (Jurij Smakov).
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sun, 12 Jun 2005 21:07:22 +0000
+
+torrus (0.99.0.20050603-1) experimental; urgency=low
+
+  * Moved rrdup_notify.sh to doc/examples, it needs to be edited before
+    being useful (Marc Haber).
+  * Corrected a typo in torrus-apache description, incorrectly stating
+    that support for Apache 2.x is provided by torrus-apache (should
+    be torrus-apache2) (Jurij Smakov). Closes: #306992
+  * Documentation in .txt format is included as upstream builds it now.
+  * Added a manpage for a new command ttproclist, will submit
+    upstream for inclusion (Jurij Smakov).
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Fri,  3 Jun 2005 23:38:21 +0000
+
+torrus (0.99.0.20040410-1) experimental; urgency=low
+
+  * First release in Debian. Closes: #186828
+  * This is a packaged upstream snapshot. Since it is not an upstream
+    release, this package is meant for experimental to allow testing in
+    Debian.
+  * Package by Jurij Smakov, sponsored by Marc Haber.
+
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sun, 24 Apr 2005 18:24:34 +0000
--- torrus-1.0.8.orig/debian/html/Makefile
+++ torrus-1.0.8/debian/html/Makefile
@@ -0,0 +1,15 @@
+htmldocs = $(patsubst %.pod, %.html, $(notdir $(wildcard ../../doc/*.pod)))
+
+all: $(htmldocs)
+	cd devdoc && $(MAKE)
+clean:
+	rm -f *~ *.tmp
+	rm -f $(htmldocs)
+	cd devdoc && $(MAKE) clean
+
+%.html: ../../doc/%.pod
+	pod2html --infile=$< --outfile=$@ \
+		--htmlroot='file:///usr/share/doc/torrus-common' \
+		--podroot='../../doc' --noindex -norecurse
+
+.PHONY: all clean
--- torrus-1.0.8.orig/debian/html/devdoc/Makefile
+++ torrus-1.0.8/debian/html/devdoc/Makefile
@@ -0,0 +1,12 @@
+htmldocs = $(patsubst %.pod, %.html, $(notdir $(wildcard ../../../doc/devdoc/*.pod)))
+
+all: $(htmldocs)
+
+clean:
+	rm -f *~ *.tmp
+	rm -f $(htmldocs)
+
+%.html : ../../../doc/devdoc/%.pod
+	pod2html --infile=$< --outfile=$@ \
+		--htmlroot='file:///usr/share/doc/torrus-common' \
+		--podroot='../../../doc/devdoc' --noindex -norecurse
--- torrus-1.0.8.orig/debian/patches/02_torrus_siteconfig.dpatch
+++ torrus-1.0.8/debian/patches/02_torrus_siteconfig.dpatch
@@ -0,0 +1,27 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_torrus_siteconfig.dpatch by  <jurijus@bobcat>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Comment out dummy tree
+
+@DPATCH@
+diff -urNad head/configs/torrus-siteconfig.pl /tmp/dpep.Mknz9l/head/configs/torrus-siteconfig.pl
+--- head/configs/torrus-siteconfig.pl	2004-11-24 13:24:56.000000000 -0500
++++ /tmp/dpep.Mknz9l/head/configs/torrus-siteconfig.pl	2005-04-02 19:20:59.584480056 -0500
+@@ -5,11 +5,11 @@
+ 
+ %Torrus::Global::treeConfig =
+     (
+-     'main' => {
+-         'description' => 'The main tree',
+-         'info'        => 'some tree',
+-         'xmlfiles' => [qw(routers.xml)],
+-         'run' => { 'collector' => 1, 'monitor' => 0 } }
++#     'main' => {
++#         'description' => 'The main tree',
++#         'info'        => 'some tree',
++#         'xmlfiles' => [qw(routers.xml)],
++#         'run' => { 'collector' => 1, 'monitor' => 0 } }
+      );
+ 
+ # Customizable look in the HTML page top
--- torrus-1.0.8.orig/debian/patches/01_collector_rrd_path.dpatch
+++ torrus-1.0.8/debian/patches/01_collector_rrd_path.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_collector_rrd_path.dpatch by  <jurijus@bobcat>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Our RRD storage is /var/lib/torrus/collector_rrd and not /srv
+
+@DPATCH@
+diff -urNad head/scripts/rrdup_notify.sh /tmp/dpep.IhEyym/head/scripts/rrdup_notify.sh
+--- head/scripts/rrdup_notify.sh	2005-03-22 11:24:57.000000000 -0500
++++ /tmp/dpep.IhEyym/head/scripts/rrdup_notify.sh	2005-04-02 19:12:40.096413784 -0500
+@@ -9,7 +9,7 @@
+ #
+ 
+ # Where the RRD files are located. Separate multiple paths with space
+-RRDSTORAGE=/srv/torrus/collector_rrd
++RRDSTORAGE=/var/lib/torrus/collector_rrd
+ 
+ # Maximum allowed age of an RRD file, in minutes.
+ MAXAGE=60
--- torrus-1.0.8.orig/debian/patches/04_doc-installation.dpatch
+++ torrus-1.0.8/debian/patches/04_doc-installation.dpatch
@@ -0,0 +1,25 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 04-doc-installation.dpatch by  <jurijus@bobcat>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: adapt install.pod to tell people that they do not need to worry
+## DP: about the nightmare dependencies of this package.
+
+@DPATCH@
+diff -urNad --exclude=CVS --exclude=.svn ./doc/install.pod.in /tmp/dpep-work.ZVvk6r/head/doc/install.pod.in
+--- ./doc/install.pod.in	2005-06-09 11:46:04.000000000 -0400
++++ /tmp/dpep-work.ZVvk6r/head/doc/install.pod.in	2005-06-11 19:01:09.000000000 -0400
+@@ -22,7 +22,12 @@
+ 
+ =head1 Torrus Installation Instructions
+ 
+-
++B<Note to Debian users:> if you have installed torrus using Debian packages,
++all the needed dependencies outlined below have been satisfied and 
++installation tasks carried out by the Debian package management system.
++The information below is provided for information purposes only and may
++not apply to the Debian torrus installations. Please see the README.Debian
++file in /usr/share/doc/torrus-common for more details.
+ 
+ =head2 Required Software
+ 
--- torrus-1.0.8.orig/debian/patches/00list
+++ torrus-1.0.8/debian/patches/00list
@@ -0,0 +1,5 @@
+01_collector_rrd_path.dpatch
+02_torrus_siteconfig.dpatch
+03_doc-userguide.dpatch
+04_doc-installation.dpatch
+10_rrdup_notify
--- torrus-1.0.8.orig/debian/patches/03_doc-userguide.dpatch
+++ torrus-1.0.8/debian/patches/03_doc-userguide.dpatch
@@ -0,0 +1,61 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03-doc-userguide.dpatch by  <jurijus@bobcat>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Adapt user guide to Debian packaging
+
+@DPATCH@
+diff -urNad torrus-1.0.5~/doc/userguide.pod.in torrus-1.0.5/doc/userguide.pod.in
+--- torrus-1.0.5~/doc/userguide.pod.in	2006-08-04 01:38:00.000000000 -0700
++++ torrus-1.0.5/doc/userguide.pod.in	2007-02-04 22:05:05.000000000 -0800
+@@ -27,13 +27,14 @@
+ 
+ The steps below will explain you how to make the thing running.
+ 
+-B<Install Torrus>. Follow the I<Torrus Installation Instructions> document,
+-all prerequisits and necessary steps are described there.
++B<Note to Debian users:> please read the README.Debian file in 
++/usr/share/doc/torrus-common directory for some Debian-specific
++information.
+ 
+ B<What is where>. The executables reside in 
+ F<@pkgbindir@/>. You normally don't need to access this
+ directory, because the commandline wrapper, C<torrus>, is installed
+-in a usual execution path (F<@bindir@>).
++in a usual execution path (F</usr/sbin>).
+ All site-specific behaviour is controlled by
+ configuration files in F<@siteconfdir@/>.
+ Usually you need to change F<torrus-siteconfig.pl> only. In this file, you
+@@ -183,12 +184,6 @@
+ process, and write only error messages in its log file,
+ F<@logdir@/collector.treename.log>.
+ 
+-There is a file that is created by C<./configure>, called F<init.d/torrus>.
+-You may place it into a directory where your system looks for startup scripts
+-(F</etc/init.d/> on Solaris and some Linuxes, F</usr/local/etc/rc.d/>
+-on FreeBSD). Probably you need to rename and edit the script before using.
+-Note that it also executes another daemon, C<monitor>.
+-
+ The C<monitor> daemon is used for monitoring the thresholds in the
+ data files. For more details, see the I<Torrus XML configuration guide>,
+ in the section about monitor definitions.
+@@ -384,6 +379,9 @@
+ 
+ =head3 Amending autogenerated XML files with XUpdate
+ 
++B<Note to Debian users:> not all the utilities mentioned in this section
++are packaged for Debian at this time.
++
+ Sometimes there is a need to modify the configuration generated by
+ C<devdiscover>. Modifying the generated XML files by hand would not be
+ a good option: it would need some manual work every time you update
+@@ -558,6 +556,9 @@
+ 
+ =head3 Several Torrus instances on one server
+ 
++B<Note to Debian users:> in the current packaging scheme only one Torrus
++instance per server is supported.
++
+ Sometimes it is necessary to have a separate instance of Torrus for testing
+ purposes on the same server as the production installation.
+ In the example below, a completely autonomous installation of Torrus is
--- torrus-1.0.8.orig/debian/patches/10_rrdup_notify.dpatch
+++ torrus-1.0.8/debian/patches/10_rrdup_notify.dpatch
@@ -0,0 +1,36 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10-rrdup_notify.dpatch by Marc Haber <mh+debian-packages@zugschlus.de>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Allow rrdup_notify to be configured from /etc/default/torrus-common
+
+@DPATCH@
+diff -urNad trunk~/scripts/rrdup_notify.sh trunk/scripts/rrdup_notify.sh
+--- trunk~/scripts/rrdup_notify.sh	2008-02-16 16:04:00.000000000 +0100
++++ trunk/scripts/rrdup_notify.sh	2008-02-16 16:06:03.000000000 +0100
+@@ -8,14 +8,22 @@
+ # Stanislav Sinyagin <ssinyagin@yahoo.com>
+ #
+ 
++# pull in configuration variables
++test -f /etc/default/torrus-common && . /etc/default/torrus-common
++
++if [ -z "$RRDUP_N_NOTIFY" ]; then
++  # nothing to do
++  exit 0
++fi
++
+ # Where the RRD files are located. Separate multiple paths with space
+-RRDSTORAGE=/var/lib/torrus/collector_rrd
++RRDSTORAGE=${RRDUP_N_RRDSTORAGE:-/var/lib/torrus/collector_rrd}
+ 
+ # Maximum allowed age of an RRD file, in minutes.
+-MAXAGE=60
++MAXAGE=${RRDUP_N_MAXAGE:-60}
+ 
+ # Where to send complaints
+-NOTIFY=root
++NOTIFY=$RRDUP_N_NOTIFY
+ 
+ TMPFILE=/tmp/rrdup_notify.$$
+ 
--- torrus-1.0.8.orig/debian/bug/torrus-common/presubj
+++ torrus-1.0.8/debian/bug/torrus-common/presubj
@@ -0,0 +1,11 @@
+Before reporting a bug please make sure that this is a real problem. 
+A typical example is a situation in which Torrus displays incorrect or
+erroneous information due to some misconfiguration. The incorrectly
+generated web pages get cached both by Torrus and your browser, so it might
+appear that the problem still persists, even after the configuration
+has been corrected. To make sure that there is really a bug in Torrus,
+please read the instructions on restarting Torrus and cleaning the cache
+in /usr/share/doc/torrus-common/README.Debian.gz and check whether the
+problem is still there afterwards.
+
+Thank you for your contribution.
--- torrus-1.0.8.orig/debian/lintian/overrides/torrus-common
+++ torrus-1.0.8/debian/lintian/overrides/torrus-common
@@ -0,0 +1,4 @@
+package-contains-empty-directory usr/share/torrus/plugins/devdiscover-config/
+package-contains-empty-directory usr/share/torrus/plugins/torrus-config/
+package-contains-empty-directory usr/share/torrus/sup/webscripts/
+package-contains-empty-directory usr/share/torrus/plugins/wrapper/
