1:5.8.1p1-3
[openssh.git] / debian / substitute-conffile.pl
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 }