summaryrefslogtreecommitdiff
path: root/debian/substitute-conffile.pl
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2006-12-23 18:35:21 +0000
committerColin Watson <cjwatson@debian.org>2006-12-23 18:35:21 +0000
commitae04de0cb0a8b65548e009b4c3a03ba7f882e95a (patch)
tree002b0415576f0581ef3f866261951ddb9fe2eb8b /debian/substitute-conffile.pl
parent309e8aeed9f3d4b7b5e9ad7089889533023b6e73 (diff)
* 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.
Diffstat (limited to 'debian/substitute-conffile.pl')
-rw-r--r--debian/substitute-conffile.pl26
1 files changed, 26 insertions, 0 deletions
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 @@
1#! /usr/bin/perl -p
2
3# This is needed for a nasty preinst hack to work around a bug in sarge's
4# version of dpkg. It substitutes the literal text of conffiles into preinst
5# scripts so that they can be used when moving conffiles between packages.
6
7BEGIN {
8 %texts = ();
9 while (@ARGV > 1) {
10 my $name = $ARGV[0];
11 shift;
12 local *FILE;
13 open FILE, '<', $ARGV[0];
14 local $/ = undef;
15 my $text = <FILE>;
16 close FILE;
17 # Quote for the shell.
18 $text =~ s/'/'\\''/g;
19 shift;
20 $texts{$name} = $text;
21 }
22}
23
24for my $name (keys %texts) {
25 s/\@$name\@/'$texts{$name}'/g;
26}