From d827c6cf1631209f5042a9d1d8a7ecc24223c8a0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 23:06:40 +0200 Subject: Adding upstream version 13.11.4. Signed-off-by: Daniel Baumann --- dh_installwm | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 dh_installwm (limited to 'dh_installwm') diff --git a/dh_installwm b/dh_installwm new file mode 100755 index 0000000..d5e0599 --- /dev/null +++ b/dh_installwm @@ -0,0 +1,140 @@ +#!/usr/bin/perl + +=head1 NAME + +dh_installwm - register a window manager + +=cut + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + +=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). It must be installed in +F in the package build directory prior to calling +B. In compat 9 and earlier, the manpage was optional. + +=head1 FILES + +=over 4 + +=item debian/I.wm + +List window manager programs to register. + +Supports substitution variables in compat 13 and later as +documented in L. + +=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<--no-scripts> + +Do not modify F/F scripts. Turns this command into a no-op. + +=item B<-A>, B<--all> + +Modify scripts for window managers specified by command line +parameters in ALL packages acted on, not just the first. + +=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(options => { + "priority=s" => \$dh{PRIORITY}, +}); + +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]"; + } +} + +my $nodocs = is_build_profile_active('nodoc') || get_buildoption('nodoc') ? 1 : 0; + +# PROMISE: DH NOOP WITHOUT wm cli-options() + +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", { 'WM' => $wm }); + + my $wmman; + 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", { 'WM' => $wm, 'WMMAN' => "${wmman}.gz" , 'PRIORITY' => $dh{PRIORITY} }); + next WM; + } + } + if (not compat(9) and not $nodocs) { + error("no manpage found (creating an x-window-manager alternative requires a slave symlink for the manpage)"); + } else { + warning("no manpage found (creating an x-window-manager alternative requires a slave symlink for the manpage)"); + } + # Reaching this code means a broken package will be produced. + autoscript($package,"postinst","postinst-wm-noman", { 'WM' => $wm, 'PRIORITY' => $dh{PRIORITY} }); + } + } +} + +=head1 SEE ALSO + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Joey Hess + +=cut -- cgit v1.2.3