From 780fefcdcfd21f335378899f2e20d92978b476e7 Mon Sep 17 00:00:00 2001 From: joeyh Date: Sun, 8 Jul 2007 22:16:15 +0000 Subject: =?UTF-8?q?r2010:=20*=20dh=5Ficons:=20New=20program=20to=20update?= =?UTF-8?q?=20Freedesktop=20icon=20caches.=20Thanks=20=20=20to=20Josselin?= =?UTF-8?q?=20Mouette,=20Ross=20Burton,=20Jordi=20Mallach,=20and=20Lo?= =?UTF-8?q?=C3=AFc=20Minier.=20=20=20Closes:=20#329460=20*=20Note=20that?= =?UTF-8?q?=20as=20a=20transitional=20measure,=20dh=5Ficons=20will=20curre?= =?UTF-8?q?ntly=20only=20update=20=20=20existing=20caches,=20and=20not=20c?= =?UTF-8?q?reate=20and=20new=20caches.=20Once=20everything=20is=20=20=20up?= =?UTF-8?q?dating=20the=20icon=20caches,=20this=20will=20be=20changed.=20S?= =?UTF-8?q?ee=20#329460=20for=20the=20full=20=20=20plan.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dh_icons | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 dh_icons (limited to 'dh_icons') diff --git a/dh_icons b/dh_icons new file mode 100755 index 00000000..aa077e47 --- /dev/null +++ b/dh_icons @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w + +=head1 NAME + +dh_icons - Update Freedesktop icon caches + +=cut + +use strict; +use File::Find; +use Debian::Debhelper::Dh_Lib; + +=head1 SYNOPSIS + +B [S>] [B<-n>] + +=head1 DESCRIPTION + +dh_icons is a debhelper program that updates Freedesktop icon caches +when needed, using the gtk-update-icon-cache program provided by GTK+2.0. +Currently this program does not handle installation of the files, though it +may do so at a later date. It takes care of adding maintainer script +fragments to call F. + +=head1 OPTIONS + +=over 4 + +=item B<-n>, B<--noscripts> + +Do not modify maintainer scripts. + +=cut + +init(); + +my $baseicondir="/usr/share/icons"; + +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); + my $icondir="$tmp$baseicondir"; + if (-d $icondir) { + my @dirlist; + opendir(DIRHANDLE, $icondir); + while (my $subdir = readdir(DIRHANDLE)) { + next if $subdir =~ /^\./; + my $needs_cache = 0; + find sub { + $needs_cache = 1 if -f and (/\.png$/ or /\.svg$/ or /\.jpg$/); + }, "$icondir/$subdir" ; + push @dirlist, "$baseicondir/$subdir" if $needs_cache; + } + if (@dirlist and ! $dh{NOSCRIPTS}) { + my $list=join(" ", @dirlist); + autoscript($package,"postinst","postinst-icons","s%#DIRLIST#%$list%"); + autoscript($package,"postrm","postrm-icons","s%#DIRLIST#%$list%"); + } + } +} + +=head1 SEE ALSO + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Ross Burton +Jordi Mallach +Josselin Mouette + +=cut -- cgit v1.2.3