]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxaw
r467: * dh_installinfo: doc enchancement, Closes: #97515
[debhelper.git] / dh_installxaw
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installxaw - install xaw wrappers config files into package build directories
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14   dh_installxaw [debhelper options] [-n]
15
16 =head1 DESCRIPTION
17
18 dh_installxaw is a debhelper program that is responsible for installing
19 xaw wrappers config files into package build directories.
20
21 It also automatically generates the postinst, prerm, and postrm commands
22 needed to interface with the debian xaw-wrappers package. See
23 L<dh_installdeb(1)> for an explanation of how this works.
24
25 If a file named debian/package.xaw exists, then it is installed into
26 usr/lib/xaw-wrappers/config/package in the package build directory.
27
28 =head1 OPTIONS
29
30 =over 4
31
32 =item B<-n>, B<--noscripts>
33
34 Do not modify postinst/prerm/postrm scripts.
35
36 =back
37
38 =head1 NOTES
39
40 Note that this command is not idempotent. "dh_clean -k" should be called
41 between invocations of this command. Otherwise, it may cause multiple
42 instances of the same text to be added to maintainer scripts.
43
44 =cut
45
46 init();
47
48 foreach my $package (@{$dh{DOPACKAGES}}) {
49         my $tmp=tmpdir($package);
50         my $xaw=pkgfile($package,'xaw');
51
52         if ($xaw ne '') {
53                 if (! -d "$tmp/usr/share/xaw-wrappers/config") {
54                         doit("install","-d","$tmp/usr/share/xaw-wrappers/config");
55                 }
56                 doit("install","-p","-m644",$xaw,
57                         "$tmp/usr/share/xaw-wrappers/config/$package");
58
59                 if (! $dh{NOSCRIPTS}) {
60                         # Parse the xaw conf file to figure out what programs
61                         # and link names are present in it. Have to pass
62                         # those into the scripts.
63                         my %data;
64                         my $install_opts='';
65                         my $remove_opts='';
66                         my $stanza='';
67                         
68                         open (IN,$xaw);
69                         while (<IN>) {
70                                 chomp;
71                                 s/\s+/ /g;
72                                 if (/^#/ eq '') {
73                                         if (/(.*?):\s?(.*)/) {
74                                                 $data{lc($1)}=$2;
75                                                 $stanza=1;
76                                         }
77                                         elsif ($stanza) {
78                                                 $install_opts.="'$data{program} $data{'link-name'} $data{wrapped}' ";
79                                                 $remove_opts.="'$data{'link-name'} $data{wrapped}' ";
80                                                 undef %data;
81                                                 $stanza='';
82                                         }
83                                 }
84                         }
85                         close IN;
86
87                         if ($stanza) {
88                                 $install_opts.="'$data{program} $data{'link-name'} $data{wrapped}'";
89                                 $remove_opts.="'$data{'link-name'} $data{wrapped}'";
90                         }
91                         
92                         autoscript($package,"postinst","postinst-xaw",
93                                 "s:#OPTS#:$install_opts:");
94                         autoscript($package,"prerm","prerm-xaw",
95                                 "s:#OPTS#:$remove_opts:");
96                         autoscript($package,"postrm","postrm-xaw");
97                 }
98         }
99 }
100
101 =head1 SEE ALSO
102
103 L<debhelper(1)>
104
105 This program is a part of debhelper.
106
107 =head1 AUTHOR
108
109 Joey Hess <joeyh@debian.org>
110
111 =cut