From 85ad35770e541b848bf2954424879318da797b84 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 24 Oct 1999 23:19:28 +0000 Subject: r294: * Fixed problem with dh_installemacsen options not working, patch from Rafael Laboissiere , Closes: #47738 * Added new dh_installxfonts script by Changwoo Ryu . Closes: #46684 I made some changes, though: - I rewrote lots of this script to be more my style of perl. - I removed all the verbisity from the postinst script fragment, since that is a clear violation of policy. - I made the postinst fail if the mkfontdir, etc commands fail, because this really makes more sense. Consider idempotency. - I moved the test to see if the font dir is really a directory into the dh_ script and out of the snippet. If the maintainer plays tricks on us, mkfontdir will blow up satisfactorally anyway. - So, the snippet is 9 lines long now, down from 20-some. - I realize this isn't following the reccommendations made in Brandon's font policy. I'll fight it out with him. :-) - In postrm fragment, used rmdir -p to remove as many parent directories as I can. - s:/usr/lib/X11/:/usr/X11R6/lib/X11/:g --- dh_installxfonts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 dh_installxfonts (limited to 'dh_installxfonts') diff --git a/dh_installxfonts b/dh_installxfonts new file mode 100755 index 00000000..e1a46aab --- /dev/null +++ b/dh_installxfonts @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w +# +# Integration with the Debian X11 font policy. + +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib; +init(); + +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + + # Find all fint directories in the package build directory. + opendir DIR, "$TMP/usr/X11R6/lib/X11/fonts/" || next; + my @fontdirs = grep { -d $_ && !/^\./ } (readdir DIR); + closedir DIR; + + if (@fontdirs) { + # Figure out what commands the postinst will need to call. + my @updatecmds=('/usr/bin/X11/mkfontdir'); + foreach my $f (@fontdirs) { + push @updatecmds, '/usr/sbin/update-fonts-alias' + if -f "$TMP/etc/X11/fonts/$f/$PACKAGE.alias"; + # This must come _before_ mkfontdir, thus the unshift. + unshift @updatecmds, '/usr/sbin/update-fonts-scale' + if -f "$TMP/etc/X11/fonts/$f/$PACKAGE.scale"; + } + + autoscript($PACKAGE, "postinst", "postinst-xfonts", + "s:#FONTDIRS#:".join(' ', @fontdirs). + ":;s:#UPDATECMDS#:".join(' ', @updatecmds).":"); + autoscript($PACKAGE, "postrm", "postrm-xfonts", + "s:#FONTDIRS#:".join(' ', @fontdirs). + ":;s:#UPDATECMDS#:".join(' ', @updatecmds).":"); + } +} -- cgit v1.2.3