]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxaw
r348: * Fixes for perl 5.6.
[debhelper.git] / dh_installxaw
1 #!/usr/bin/perl -w
2 #
3 # Integration with xaw-wrappers
4 #
5 # If debian/xaw-wrappers file exists, save it to 
6 # $TMP/usr/share/xaw-wrappers/config/$PACKAGE
7 #
8 # Also, add calls to postinst and postrm.
9
10 use Debian::Debhelper::Dh_Lib;
11 init();
12
13 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
14         $TMP=tmpdir($PACKAGE);
15         $xaw=pkgfile($PACKAGE,'xaw');
16
17         if ($xaw ne '') {
18                 if (! -d "$TMP/usr/share/xaw-wrappers/config") {
19                         doit("install","-d","$TMP/usr/share/xaw-wrappers/config");
20                 }
21                 doit("install","-p","-m644",$xaw,
22                         "$TMP/usr/share/xaw-wrappers/config/$PACKAGE");
23
24                 if (! $dh{NOSCRIPTS}) {
25                         # Parse the xaw conf file to figure out what programs
26                         # and link names are present in it. Have to pass
27                         # those into the scripts.
28                         my %data;
29                         my $install_opts='';
30                         my $remove_opts='';
31                         my $stanza='';
32                         
33                         open (IN,$xaw);
34                         while (<IN>) {
35                                 chomp;
36                                 s/\s+/ /g;
37                                 if (/^#/ eq '') {
38                                         if (/(.*?):\s?(.*)/) {
39                                                 $data{lc($1)}=$2;
40                                                 $stanza=1;
41                                         }
42                                         elsif ($stanza) {
43                                                 $install_opts.="'$data{program} $data{'link-name'} $data{wrapped}' ";
44                                                 $remove_opts.="'$data{'link-name'} $data{wrapped}' ";
45                                                 undef %data;
46                                                 $stanza='';
47                                         }
48                                 }
49                         }
50                         close IN;
51
52                         if ($stanza) {
53                                 $install_opts.="'$data{program} $data{'link-name'} $data{wrapped}'";
54                                 $remove_opts.="'$data{'link-name'} $data{wrapped}'";
55                         }
56                         
57                         autoscript($PACKAGE,"postinst","postinst-xaw",
58                                 "s:#OPTS#:$install_opts:");
59                         autoscript($PACKAGE,"prerm","prerm-xaw",
60                                 "s:#OPTS#:$remove_opts:");
61                         autoscript($PACKAGE,"postrm","postrm-xaw");
62                 }
63         }
64 }