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