]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installwm
r377: * dh_installwm: patched a path in some backwards compatability code.
[debhelper.git] / dh_installwm
index be3a1373627cad96def230a9d488a77a7974c656..93d464d2a3b39e0aac781d4106ab5a244c3df4a6 100755 (executable)
@@ -1,21 +1,39 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Add to postinst and postrm to register a window manager.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Debian::Debhelper::Dh_Lib;
+init();
 
-wm=$1
+if (! defined $dh{PRIORITY}) {
+        $dh{PRIORITY}=20;
+}
 
-if [ -z "$wm" ]; then
-       error "No window manager was specified."
-fi
+if (@ARGV) {
+       # This is here for backwards comatability. 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");
+
+       if ($file) {
+               @wm=filearray($file);
+       }
+
+       if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+               push @wm, @ARGV;
+       }
+
+       if (@wm && ! $dh{NOSCRIPTS}) {
+               foreach (@wm) {
+                       autoscript($PACKAGE,"postinst","postinst-wm","s:#WM#:$_:;s/#PRIORITY#/$dh{PRIORITY}/",);
+                       autoscript($PACKAGE,"postrm","postrm-wm","s:#WM#:$_:");
+               }
+       }
+}
 
-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