]> git.donarmstrong.com Git - debhelper.git/blob - dh_installwm
Typo. Closes: #653339
[debhelper.git] / dh_installwm
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installwm - register a window manager
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installwm> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [S<I<wm> ...>]
15
16 =head1 DESCRIPTION
17
18 B<dh_installwm> is a debhelper program that is responsible for
19 generating the F<postinst> and F<prerm> commands that register a window manager
20 with L<update-alternatives(8)>. The window manager's man page is also 
21 registered as a slave symlink (in v6 mode and up), if it is found in 
22 F<usr/share/man/man1/> in the package build directory.
23
24 =head1 FILES
25
26 =over 4
27
28 =item debian/I<package>.wm
29
30 List window manager programs to register.
31
32 =back
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item B<--priority=>I<n>
39
40 Set the priority of the window manager. Default is 20, which is too low for
41 most window managers; see the Debian Policy document for instructions on
42 calculating the correct value.
43
44 =item B<-n>, B<--noscripts>
45
46 Do not modify F<postinst>/F<prerm> scripts. Turns this command into a no-op.
47
48 =item I<wm> ...
49
50 Window manager programs to register.
51
52 =back
53
54 =head1 NOTES
55
56 Note that this command is not idempotent. L<dh_prep(1)> should be called
57 between invocations of this command. Otherwise, it may cause multiple
58 instances of the same text to be added to maintainer scripts.
59
60 =cut
61
62 init();
63
64 if (! defined $dh{PRIORITY}) {
65         $dh{PRIORITY}=20;
66 }
67
68 if (@ARGV) {
69         # This is here for backwards compatibility. If the filename doesn't
70         # include a path, assume it's in /usr/bin.
71         if ($ARGV[0] !~ m:/:) {
72                 $ARGV[0]="/usr/bin/$ARGV[0]";
73         }
74 }
75
76 foreach my $package (@{$dh{DOPACKAGES}}) {
77         my $tmp=tmpdir($package);
78         my $file=pkgfile($package,"wm");
79
80         my @wm;
81         if ($file) {
82                 @wm=filearray($file, '.');
83         }
84
85         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
86                 push @wm, @ARGV;
87         }
88
89         if (! $dh{NOSCRIPTS}) {
90 WM:             foreach my $wm (@wm) {
91                         autoscript($package,"prerm","prerm-wm","s:#WM#:$wm:");
92
93                         my $wmman;
94                         if (! compat(5)) {
95                                 foreach my $ext (".1", ".1x") {
96                                         $wmman="/usr/share/man/man1/".basename($wm).$ext;
97                                         if (-e "$tmp$wmman" || -e "$tmp$wmman.gz") {
98                                                 autoscript($package,"postinst","postinst-wm","s:#WM#:$wm:;s:#WMMAN#:$wmman.gz:;s/#PRIORITY#/$dh{PRIORITY}/",);
99                                                 next WM;
100                                         }
101                                 }
102                         }
103                         autoscript($package,"postinst","postinst-wm-noman","s:#WM#:$wm:;s/#PRIORITY#/$dh{PRIORITY}/",);
104                 }
105         }
106 }
107
108 =head1 SEE ALSO
109
110 L<debhelper(7)>
111
112 This program is a part of debhelper.
113
114 =head1 AUTHOR
115
116 Joey Hess <joeyh@debian.org>
117
118 =cut