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