summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2008-04-11 05:04:54 +0000
committerGuillem Jover <guillem@hadrons.org>2010-06-10 23:21:22 +0200
commit7fc362a335cd0c6f2cdfdcc0c7e845d6fd6b6d25 (patch)
tree81bdc5779640d938578fae9668e1f3b51f2c144c
parentc57976b73376c621c31d64110860ed0c29116a68 (diff)
downloadinetutils-7fc362a335cd0c6f2cdfdcc0c7e845d6fd6b6d25.tar.gz
Keep inetutils-syslogd under /etc/default/ instead of syslogd
Take care of removing the obsolete conffile if non-modified. Move it to the new name otherwise.
-rw-r--r--debian/changelog5
-rw-r--r--debian/inetutils-syslogd.init2
-rw-r--r--debian/inetutils-syslogd.postinst31
-rw-r--r--debian/inetutils-syslogd.preinst34
-rwxr-xr-xdebian/rules3
5 files changed, 69 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog
index 418b571..bc386ef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,8 +10,9 @@ inetutils (2:1.5.dfsg.1-5) UNRELEASED; urgency=low
the build to a new setup-source target thar serializes configureation.
* Do not ignore make errors on clean or install in debian/rules.
* Switch Build-Depends from automake1.9 to automake.
- * Do not install a duplicated inetutils-syslogd in /etc/default/, just
- syslogd. (Closes: #435049)
+ * Do not install a duplicated syslogd under /etc/default/, just
+ inetutils-syslogd. Take care of removing the obsolete conffile if not
+ modified, and move it to the new name otherwise. (Closes: #435049)
* Do not start inetd if there's no services enabled (stolen from
openbsd-inetd).
* Complete copyright information in debian/copyright file.
diff --git a/debian/inetutils-syslogd.init b/debian/inetutils-syslogd.init
index f57cbcb..12cf22f 100644
--- a/debian/inetutils-syslogd.init
+++ b/debian/inetutils-syslogd.init
@@ -11,7 +11,7 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/syslogd
NAME=syslogd
-CONFIGFILE=/etc/default/syslogd
+CONFIGFILE=/etc/default/inetutils-syslogd
PIDFILE=/var/run/syslog.pid
DESC="system log daemon"
diff --git a/debian/inetutils-syslogd.postinst b/debian/inetutils-syslogd.postinst
new file mode 100644
index 0000000..36e4549
--- /dev/null
+++ b/debian/inetutils-syslogd.postinst
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+set -e
+
+# Move a conffile without triggering a dpkg question
+mv_conffile()
+{
+ oldconffile="$1"
+ newconffile="$2"
+
+ if [ -e "$oldconffile" ]; then
+ echo "Preserving user changes to $newconffile ..."
+ mv -f "$newconffile" "$newconffile".dpkg-new
+ mv -f "$oldconffile" "$newconffile"
+ fi
+}
+
+case "$1" in
+configure)
+ if dpkg --compare-versions "$2" lt "2:1.5.dfsg.1-5"; then
+ mv_conffile /etc/default/syslogd /etc/default/inetutils-syslogd
+ fi
+esac
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/inetutils-syslogd.preinst b/debian/inetutils-syslogd.preinst
new file mode 100644
index 0000000..8a1f205
--- /dev/null
+++ b/debian/inetutils-syslogd.preinst
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+set -e
+
+# Prepare to move a conffile without triggering a dpkg question
+prep_mv_conffile()
+{
+ pkgname="$1"
+ conffile="$2"
+
+ if [ -e "$conffile" ]; then
+ md5sum="`md5sum \"$conffile\" | sed -e \"s/ .*//\"`"
+ old_md5sum="`dpkg-query -W -f='${Conffiles}' $pkgname | sed -n -e \"\\\\' $conffile '{s/ obsolete$//;s/.* //p}\"`"
+ if [ "$md5sum" = "$old_md5sum" ]; then
+ echo "Removing non modified obsolete conffile $conffile ..."
+ rm -f "$conffile"
+ fi
+ fi
+}
+
+case "$1" in
+install|upgrade)
+ if dpkg --compare-versions "$2" lt "2:1.5.dfsg.1-5"; then
+ prep_mv_conffile inetutils-syslogd /etc/default/syslogd
+ fi
+esac
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/rules b/debian/rules
index af9a2bd..59e981d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -151,9 +151,6 @@ binary-arch: install
dh_installdocs -a -A NEWS AUTHORS THANKS
dh_installexamples -a
dh_installinit -pinetutils-syslogd -- defaults 10 90
- # Rename the syslogd default file
- mv $(CURDIR)/debian/inetutils-syslogd/etc/default/inetutils-syslogd \
- $(CURDIR)/debian/inetutils-syslogd/etc/default/syslogd
dh_installinit -a -Ninetutils-syslogd
dh_installpam -pinetutils-ftpd --name ftp
dh_installlogrotate -a