]> git.donarmstrong.com Git - debhelper.git/blob - dh_icons
Fix pod.
[debhelper.git] / dh_icons
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_icons - Update Freedesktop icon caches
6
7 =cut
8
9 use strict;
10 use File::Find;
11 use Debian::Debhelper::Dh_Lib;
12
13 =head1 SYNOPSIS
14
15 B<dh_icons> [S<I<debhelper options>>] [B<-n>]
16
17 =head1 DESCRIPTION
18
19 dh_icons is a debhelper program that updates Freedesktop icon caches
20 when needed, using the update-icon-caches program provided by GTK+2.12.
21 Currently this program does not handle installation of the files, though it
22 may do so at a later date. It takes care of adding maintainer script
23 fragments to call F<update-icon-caches>.
24
25 =head1 OPTIONS
26
27 =over 4
28
29 =item B<-n>, B<--noscripts>
30
31 Do not modify maintainer scripts.
32
33 =back
34
35 =cut
36
37 init();
38
39 my $baseicondir="/usr/share/icons";
40
41 foreach my $package (@{$dh{DOPACKAGES}}) {
42         my $tmp=tmpdir($package);
43         my $icondir="$tmp$baseicondir";
44         if (-d $icondir) {
45                 my @dirlist;
46                 opendir(DIRHANDLE, $icondir);
47                 while (my $subdir = readdir(DIRHANDLE)) {
48                         next if $subdir =~ /^\./;
49                         my $needs_cache = 0;
50                         find sub {
51                                 $needs_cache = 1 if -f and (/\.png$/ or /\.svg$/ or /\.xpm$/ or /\.icon$/);
52                         }, "$icondir/$subdir" ;
53                         push @dirlist, "$baseicondir/$subdir" if $needs_cache;
54                 }
55                 if (@dirlist and ! $dh{NOSCRIPTS}) {
56                         my $list=join(" ", @dirlist);
57                         autoscript($package,"postinst","postinst-icons","s%#DIRLIST#%$list%");
58                         autoscript($package,"postrm","postrm-icons","s%#DIRLIST#%$list%");
59                 }
60         }
61 }
62
63 =head1 SEE ALSO
64
65 L<debhelper>
66
67 This program is a part of debhelper.
68
69 =head1 AUTHOR
70
71 Ross Burton <ross@burtonini.com>
72 Jordi Mallach <jordi@debian.org>
73 Josselin Mouette <joss@debian.org>
74
75 =cut