From 7fc362a335cd0c6f2cdfdcc0c7e845d6fd6b6d25 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 11 Apr 2008 05:04:54 +0000 Subject: 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. --- debian/changelog | 5 +++-- debian/inetutils-syslogd.init | 2 +- debian/inetutils-syslogd.postinst | 31 +++++++++++++++++++++++++++++++ debian/inetutils-syslogd.preinst | 34 ++++++++++++++++++++++++++++++++++ debian/rules | 3 --- 5 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 debian/inetutils-syslogd.postinst create mode 100644 debian/inetutils-syslogd.preinst 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 -- cgit v1.2.3