]> git.donarmstrong.com Git - debhelper.git/blob - dh_installwm
r1980: * prerm and postrm scripts are now generated in a reverse order than
[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 dh_installwm is a debhelper program that is responsible for
19 generating the postinst and postrm 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), and is assumed to be
22 located in /usr/share/man/man1/<wm>.1.gz.
23
24 Any window manager programs specified as parameters will be registered in
25 the first package dh_installwm is told to act on. By default, this is the
26 first binary package in debian/control, but if you use -p, -i, or -a flags,
27 it will be the first package specified by those flags.
28
29 Files named debian/package.wm can list other window manager programs to
30 register.
31
32 =head1 OPTIONS
33
34 =over 4
35
36 =item B<--priority=>I<n>
37
38 Set the priority of the window manager. Default is 20, which is too low for
39 most window managers; see the Debian Policy document for instructions on
40 calculating the correct value.
41
42 =item B<-n>, B<--noscripts>
43
44 Do not modify postinst/postrm scripts. Turns this command into a no-op.
45
46 =item I<wm ...>
47
48 The commands used to run the window manager or window managers you want to
49 register.
50
51 =head1 NOTES
52
53 Note that this command is not idempotent. "dh_clean -k" should be called
54 between invocations of this command. Otherwise, it may cause multiple
55 instances of the same text to be added to maintainer scripts.
56
57 =back
58
59 =cut
60
61 init();
62
63 if (! defined $dh{PRIORITY}) {
64         $dh{PRIORITY}=20;
65 }
66
67 if (@ARGV) {
68         # This is here for backwards compatibility. If the filename doesn't
69         # include a path, assume it's in /usr/X11R6/bin.
70         if ($ARGV[0] !~ m:/:) {
71                 $ARGV[0]="/usr/X11R6/bin/$ARGV[0]";
72         }
73 }
74
75 foreach my $package (@{$dh{DOPACKAGES}}) {
76 #       my $tmp=tmpdir($package);
77         my $file=pkgfile($package,"wm");
78
79         my @wm;
80         if ($file) {
81                 @wm=filearray($file, '.');
82         }
83
84         if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
85                 push @wm, @ARGV;
86         }
87
88         if (! $dh{NOSCRIPTS}) {
89                 foreach (@wm) {
90                         autoscript($package,"postinst","postinst-wm","s:#WM#:$_:;s/#PRIORITY#/$dh{PRIORITY}/",);
91                         autoscript($package,"prerm","prerm-wm","s:#WM#:$_:");
92                 }
93         }
94 }
95
96 =head1 SEE ALSO
97
98 L<debhelper(7)>
99
100 This program is a part of debhelper.
101
102 =head1 AUTHOR
103
104 Joey Hess <joeyh@debian.org>
105
106 =cut