summaryrefslogtreecommitdiff
path: root/dh_desktop
blob: 27a6104238a35017c6d52d4f3405fb8777a8f035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl -w

=head1 NAME

dh_desktop - Register .desktop files

=cut

use strict;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_desktop> [S<I<debhelper options>>] [B<-p<package>>]

=head1 DESCRIPTION

dh_desktop is a debhelper program that registers .desktop files.
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<update-desktop-database>.

=cut

init();

foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);

	if (-d "$tmp/usr/share/applications") {
		# Get a list of the desktop files that are in
		# usr/share/applications and thus might need
		# update-desktop-database be called. Other desktop
		# files don't.
		my $desktop_files = `find $tmp/usr/share/applications -type f -name \\*.desktop -printf '%p\n'`;
		if ($desktop_files && ! $dh{NOSCRIPTS}) {
			autoscript($package,"postinst","postinst-desktop");
			autoscript($package,"postrm","postrm-desktop");
		}
	}
}

=head1 SEE ALSO

L<debhelper>

This program is a part of debhelper.

=head1 AUTHOR

Ross Burton <ross@burtonini.com>

=cut