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