]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installwm
r1980: * prerm and postrm scripts are now generated in a reverse order than
[debhelper.git] / dh_installwm
index 7bc98aaed585bed829e3509e8e46a946ce431aec..1989056d0296cbc0da9cb777d5c8c997beaf12a9 100755 (executable)
@@ -1,8 +1,63 @@
 #!/usr/bin/perl -w
-#
-# Add to postinst and postrm to register a window manager.
 
+=head1 NAME
+
+dh_installwm - register a window manager
+
+=cut
+
+use strict;
 use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_installwm> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [S<I<wm ...>>]
+
+=head1 DESCRIPTION
+
+dh_installwm is a debhelper program that is responsible for
+generating the postinst and postrm commands that register a window manager
+with L<update-alternatives(8)>. The window manager's man page is also 
+registered as a slave symlink (in v6 mode and up), and is assumed to be
+located in /usr/share/man/man1/<wm>.1.gz.
+
+Any window manager programs specified as parameters will be registered in
+the first package dh_installwm is told to act on. By default, this is the
+first binary package in debian/control, but if you use -p, -i, or -a flags,
+it will be the first package specified by those flags.
+
+Files named debian/package.wm can list other window manager programs to
+register.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--priority=>I<n>
+
+Set the priority of the window manager. Default is 20, which is too low for
+most window managers; see the Debian Policy document for instructions on
+calculating the correct value.
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/postrm scripts. Turns this command into a no-op.
+
+=item I<wm ...>
+
+The commands used to run the window manager or window managers you want to
+register.
+
+=head1 NOTES
+
+Note that this command is not idempotent. "dh_clean -k" should be called
+between invocations of this command. Otherwise, it may cause multiple
+instances of the same text to be added to maintainer scripts.
+
+=back
+
+=cut
+
 init();
 
 if (! defined $dh{PRIORITY}) {
@@ -10,30 +65,42 @@ if (! defined $dh{PRIORITY}) {
 }
 
 if (@ARGV) {
-       # This is here for backwards comatability. If the filename doesn't
+       # This is here for backwards compatibility. If the filename doesn't
        # include a path, assume it's in /usr/X11R6/bin.
        if ($ARGV[0] !~ m:/:) {
                $ARGV[0]="/usr/X11R6/bin/$ARGV[0]";
        }
 }
 
-foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
-       $TMP=tmpdir($PACKAGE);
-       $file=pkgfile($PACKAGE,"wm");
+foreach my $package (@{$dh{DOPACKAGES}}) {
+#      my $tmp=tmpdir($package);
+       my $file=pkgfile($package,"wm");
 
+       my @wm;
        if ($file) {
-               @wm=filearray($file, $TMP);
+               @wm=filearray($file, '.');
        }
 
-       if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+       if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
                push @wm, @ARGV;
        }
 
-       if (@wm && ! $dh{NOSCRIPTS}) {
+       if (! $dh{NOSCRIPTS}) {
                foreach (@wm) {
-                       autoscript($PACKAGE,"postinst","postinst-wm","s:#WM#:$_:;s/#PRIORITY#/$dh{PRIORITY}/",);
-                       autoscript($PACKAGE,"postrm","postrm-wm","s:#WM#:$_:");
+                       autoscript($package,"postinst","postinst-wm","s:#WM#:$_:;s/#PRIORITY#/$dh{PRIORITY}/",);
+                       autoscript($package,"prerm","prerm-wm","s:#WM#:$_:");
                }
        }
 }
 
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Joey Hess <joeyh@debian.org>
+
+=cut