tags 665813 + patch
thanks

After a bit of discussion on Launchpad (Bugs: #967018 and #985508) it
turns out that the use of dpkg-maintscript-helper is "not welcome" in
this case. Even if the missing target file will be created before the
call of dpkg-maintscript-helper.

The reason behind this is that dpkg-maintscript-helper is written to
deal with conffiles. But both, the old 'rules' file and the new
'rules.v4' file, are not conffiles. Instead they are configuration
files. See [1] for the difference.

I attached a patch which replace the use of dpkg-maintscript-helper by a
simple mv command in the preinst script.


[1] http://www.debian.org/doc/debian-policy/ch-files.html#s-config-files

Cheers,
Andreas

-- 
Andreas Rütten                                  andreasruet...@gmx.de

4096R: 0x6C9DFFB2 / 8394 99DA 59BD BCE2 3FC8 3A9E 6633 0089 6C9D FFB2
From cd73e597f9f9220fa590a9f1bd07d4785efd619d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20R=C3=BCtten?= <andreasruet...@gmx.de>
Date: Fri, 20 Apr 2012 17:17:17 +0200
Subject: [PATCH] Replace the utilisation of dpkg-maintscript-helper by a
 simple mv
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

dpkg-maintscript-helper is written to deal with conffiles and not with
configuration files
Neither the old rules file nor the new rules.v4 file are conffiles so
dpkg-maintscript-helper wouldn't handle the renaming properly

Thanks to Neil Wilson and Raphaël Hertzog for the discussion on Launchpad
Bugs #967018 #985508 to figure this out

Closes: #665813
---
 debian/iptables-persistent.postinst |    3 ---
 debian/iptables-persistent.postrm   |    3 ---
 debian/iptables-persistent.preinst  |   10 ++++++++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/debian/iptables-persistent.postinst b/debian/iptables-persistent.postinst
index 8d3a565..355715b 100644
--- a/debian/iptables-persistent.postinst
+++ b/debian/iptables-persistent.postinst
@@ -5,9 +5,6 @@ set -e
 # Source debconf library
 . /usr/share/debconf/confmodule
 
-dpkg-maintscript-helper mv_conffile \
-    /etc/iptables/rules /etc/iptables/rules.v4 0.0.20101230 -- "$@"
-
 case "$1" in
 configure)
     db_get iptables-persistent/autosave_done || true
diff --git a/debian/iptables-persistent.postrm b/debian/iptables-persistent.postrm
index 5a68595..704462a 100644
--- a/debian/iptables-persistent.postrm
+++ b/debian/iptables-persistent.postrm
@@ -2,9 +2,6 @@
 
 set -e
 
-dpkg-maintscript-helper mv_conffile \
-     /etc/iptables/rules /etc/iptables/rules.v4 0.0.20101230 -- "$@"
-
 case "$1" in
 purge)
 	rm -rf /etc/iptables/rules \
diff --git a/debian/iptables-persistent.preinst b/debian/iptables-persistent.preinst
index c21da84..cd71899 100644
--- a/debian/iptables-persistent.preinst
+++ b/debian/iptables-persistent.preinst
@@ -2,7 +2,13 @@
 
 set -e
 
-dpkg-maintscript-helper mv_conffile \
-     /etc/iptables/rules /etc/iptables/rules.v4 0.0.20101230 -- "$@"
+if [ -e /etc/iptables/rules ]; then
+    if [ -e /etc/iptables/rules.v4 ]; then
+	mv -f /etc/iptables/rules /etc/iptables/rules.v4.dpkg-old
+    else
+	mv -f /etc/iptables/rules /etc/iptables/rules.v4
+    fi
+else
+fi
 
 #DEBHELPER#
-- 
1.7.5.4

Attachment: signature.asc
Description: PGP signature

Reply via email to