From ae04de0cb0a8b65548e009b4c3a03ba7f882e95a Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 23 Dec 2006 18:35:21 +0000 Subject: * It turns out that the people who told me that removing a conffile in the preinst was sufficient to have dpkg replace it without prompting when moving a conffile between packages were very much mistaken. As far as I can tell, the only way to do this reliably is to write out the desired new text of the conffile in the preinst. This is gross, and requires shipping the text of all conffiles in the preinst too, but there's nothing for it. Fortunately this nonsense is only required for smooth upgrades from sarge. --- debian/substitute-conffile.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 debian/substitute-conffile.pl (limited to 'debian/substitute-conffile.pl') diff --git a/debian/substitute-conffile.pl b/debian/substitute-conffile.pl new file mode 100644 index 000000000..7dd23363e --- /dev/null +++ b/debian/substitute-conffile.pl @@ -0,0 +1,26 @@ +#! /usr/bin/perl -p + +# This is needed for a nasty preinst hack to work around a bug in sarge's +# version of dpkg. It substitutes the literal text of conffiles into preinst +# scripts so that they can be used when moving conffiles between packages. + +BEGIN { + %texts = (); + while (@ARGV > 1) { + my $name = $ARGV[0]; + shift; + local *FILE; + open FILE, '<', $ARGV[0]; + local $/ = undef; + my $text = ; + close FILE; + # Quote for the shell. + $text =~ s/'/'\\''/g; + shift; + $texts{$name} = $text; + } +} + +for my $name (keys %texts) { + s/\@$name\@/'$texts{$name}'/g; +} -- cgit v1.2.3