X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_installwm;h=a0f5f704481b30a0b6815baeac06dd7e6e81b044;hb=e2a6d4cec4a7ee952cf6a7f250d80f1d75a38f95;hp=be3a1373627cad96def230a9d488a77a7974c656;hpb=75275ded89f0b456e7e396008af153d26bb35626;p=debhelper.git diff --git a/dh_installwm b/dh_installwm index be3a137..a0f5f70 100755 --- a/dh_installwm +++ b/dh_installwm @@ -1,21 +1,118 @@ -#!/bin/sh -e -# -# Add to postinst and postrm to register a window manager. - -PATH=debian:$PATH:/usr/lib/debhelper -. dh_lib - -wm=$1 - -if [ -z "$wm" ]; then - error "No window manager was specified." -fi - -for PACKAGE in $DH_DOPACKAGES; do - TMP=`tmpdir $PACKAGE` - - if [ ! "$DH_NOSCRIPTS" ]; then - autoscript "postinst" "postinst-wm" "s/#WM#/$wm/" - autoscript "postrm" "postrm-wm" "s/#WM#/$wm/" - fi -done +#!/usr/bin/perl -w + +=head1 NAME + +dh_installwm - register a window manager + +=cut + +use strict; +use Debian::Debhelper::Dh_Lib; + +=head1 SYNOPSIS + +B [S>] [B<-n>] [B<--priority=>I] [S ...>] + +=head1 DESCRIPTION + +B is a debhelper program that is responsible for +generating the F and F commands that register a window manager +with L. The window manager's man page is also +registered as a slave symlink (in v6 mode and up), if it is found in +F in the package build directory. + +=head1 FILES + +=over 4 + +=item debian/I.wm + +List window manager programs to register. + +=back + +=head1 OPTIONS + +=over 4 + +=item B<--priority=>I + +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 F/F scripts. Turns this command into a no-op. + +=item I ... + +Window manager programs to register. + +=back + +=head1 NOTES + +Note that this command is not idempotent. L should be called +between invocations of this command. Otherwise, it may cause multiple +instances of the same text to be added to maintainer scripts. + +=cut + +init(); + +if (! defined $dh{PRIORITY}) { + $dh{PRIORITY}=20; +} + +if (@ARGV) { + # This is here for backwards compatibility. If the filename doesn't + # include a path, assume it's in /usr/bin. + if ($ARGV[0] !~ m:/:) { + $ARGV[0]="/usr/bin/$ARGV[0]"; + } +} + +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); + my $file=pkgfile($package,"wm"); + + my @wm; + if ($file) { + @wm=filearray($file, '.'); + } + + if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { + push @wm, @ARGV; + } + + if (! $dh{NOSCRIPTS}) { +WM: foreach my $wm (@wm) { + autoscript($package,"prerm","prerm-wm","s:#WM#:$wm:"); + + my $wmman; + if (! compat(5)) { + foreach my $ext (".1", ".1x") { + $wmman="/usr/share/man/man1/".basename($wm).$ext; + if (-e "$tmp$wmman" || -e "$tmp$wmman.gz") { + autoscript($package,"postinst","postinst-wm","s:#WM#:$wm:;s:#WMMAN#:$wmman.gz:;s/#PRIORITY#/$dh{PRIORITY}/",); + next WM; + } + } + } + autoscript($package,"postinst","postinst-wm-noman","s:#WM#:$wm:;s/#PRIORITY#/$dh{PRIORITY}/",); + } + } +} + +=head1 SEE ALSO + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Joey Hess + +=cut