diff options
Diffstat (limited to 'debian/substitute-conffile.pl')
-rw-r--r-- | debian/substitute-conffile.pl | 26 |
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 | |||
7 | BEGIN { | ||
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 | |||
24 | for my $name (keys %texts) { | ||
25 | s/\@$name\@/'$texts{$name}'/g; | ||
26 | } | ||