summaryrefslogtreecommitdiff
path: root/debian/rsyslog-pgsql.postinst
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2008-03-29 12:14:46 +0100
committerMichael Biebl <biebl@debian.org>2008-03-29 12:14:46 +0100
commite1bfc41f9a8e6c7ef051686210c0f263bf512372 (patch)
tree403612780ae40da9d69f785bd09d177c69fafca6 /debian/rsyslog-pgsql.postinst
parentde624a45c50b87eb153e78cd84cf0eae8dbeddfa (diff)
downloadrsyslog-e1bfc41f9a8e6c7ef051686210c0f263bf512372.tar.gz
Imported Debian patch 1.20.1-1debian/1.20.1-1
Diffstat (limited to 'debian/rsyslog-pgsql.postinst')
-rw-r--r--debian/rsyslog-pgsql.postinst66
1 files changed, 66 insertions, 0 deletions
diff --git a/debian/rsyslog-pgsql.postinst b/debian/rsyslog-pgsql.postinst
new file mode 100644
index 0000000..016c72f
--- /dev/null
+++ b/debian/rsyslog-pgsql.postinst
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst
+
+
+db_get rsyslog-pgsql/db/dbname
+DATABASE="$RET"
+db_get rsyslog-pgsql/db/app-user
+USER="$RET"
+db_get rsyslog-pgsql/pgsql/app-pass
+PASS="$RET"
+db_get rsyslog-pgsql/remote/host
+HOST="$RET"
+[ -z "$HOST" ] && HOST="localhost"
+
+
+dbc_go rsyslog-pgsql $@
+
+
+case "$1" in
+ configure)
+ tempfile=`tempfile`
+
+ cat <<-EOF > $tempfile
+ ### Configuration file for rsyslog-pgsql
+ ### Changes are preserved
+
+ \$ModLoad ompgsql.so
+ *.* :ompgsql:$HOST,$DATABASE,$USER,$PASS
+ EOF
+
+ ucf --debconf-ok $tempfile /etc/rsyslog.d/pgsql.conf
+ ucfr rsyslog-pgsql /etc/rsyslog.d/pgsql.conf
+ rm -f $tempfile
+
+ invoke-rc.d rsyslog reload
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+
+#DEBHELPER#
+
+exit 0