]> git.donarmstrong.com Git - debhelper.git/blob - dh_ucf
fix synopsis
[debhelper.git] / dh_ucf
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_ucf - register configuration files with ucf 
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_ucf> [S<I<debhelper options>>] [B<-n>]
15
16 =head1 DESCRIPTION
17
18 B<dh_ucf> is a debhelper program that is responsible for generating the
19 F<postinst> and F<postrm> commands that register files with ucf(1) and ucfr(1).
20
21 =head1 FILES
22
23 =over 4
24
25 =item debian/I<package>.ucf
26
27 List pairs of source and destination files to register with ucf. Each pair
28 should be put on its own line, with the source and destination separated by
29 whitespace. Both source and destination must be absolute paths.
30
31 A dependency on ucf will be generated in B<${misc:Depends}>.
32
33 =back
34
35 =head1 OPTIONS
36
37 =over 4
38
39 =item B<-n>, B<--noscripts>
40
41 Do not modify F<postinst>/F<postrm> scripts. Turns this command into a no-op.
42
43 =back
44
45 =head1 NOTES
46
47 Note that this command is not idempotent. L<dh_prep(1)> should be called
48 between invocations of this command. Otherwise, it may cause multiple
49 instances of the same text to be added to maintainer scripts.
50
51 =cut
52
53 init();
54
55 foreach my $package (@{$dh{DOPACKAGES}}) {
56         my $tmp=tmpdir($package);
57         my $file=pkgfile($package,"ucf");
58
59         my @ucf;
60         if ($file) {
61                 @ucf=filedoublearray($file);
62         }
63
64         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
65                 push @ucf, [@ARGV];
66         }
67         
68         if (! $dh{NOSCRIPTS}) {
69                 if (@ucf) {
70                         addsubstvar($package, "misc:Depends", "ucf");
71                 }
72                 foreach my $set (@ucf) {
73                         my $src = $set->[0];
74                         my $dest = $set->[1];
75                         autoscript($package,"postinst","postinst-ucf","s:#UCFSRC#:$src:;s:#UCFDEST#:$dest:;s/#PACKAGE#/$package/",);
76                         autoscript($package,"postrm","postrm-ucf","s:#UCFDEST#:$dest:;s/#PACKAGE#/$package/");
77                 }
78         }
79 }
80
81 =head1 SEE ALSO
82
83 L<debhelper(7)>
84
85 This program is a part of debhelper.
86
87 =head1 AUTHOR
88
89 Joey Hess <joeyh@debian.org>
90 Jeroen Schot <schot@a-eskwadraat.nl>
91
92 =cut