]> git.donarmstrong.com Git - debhelper.git/blob - dh_installmime
r1968: * dh_fixperms: Make all files in /usr/include 644, not only .h files.
[debhelper.git] / dh_installmime
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installmime - install mime files into package build directories
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installmime> [S<I<debhelper options>>] [B<-n>]
15
16 =head1 DESCRIPTION
17
18 dh_installmime is a debhelper program that is responsible for installing
19 mime files into package build directories.
20
21 It also automatically generates the postinst and postrm commands needed to
22 interface with the debian mime-support and shared-mime-info packages. These
23 commands are inserted into the maintainer scripts by dh_installdeb. See
24 L<dh_installdeb(1)> for an explanation of how this works.
25
26 If files named debian/package.mime or debian/package.sharedmimeinfo exist, then
27 they are installed into usr/lib/mime/packages/package and
28 /usr/share/mime/packages/package.xml (respectively) in the package build
29 directory.
30
31 =head1 OPTIONS
32
33 =over 4
34
35 =item B<-n>, B<--noscripts>
36
37 Do not modify postinst/postrm scripts.
38
39 =back
40
41 =head1 NOTES
42
43 Note that this command is not idempotent. "dh_clean -k" should be called
44 between invocations of this command. Otherwise, it may cause multiple
45 instances of the same text to be added to maintainer scripts.
46
47 =cut
48
49 init();
50
51 foreach my $package (@{$dh{DOPACKAGES}}) {
52         my $tmp=tmpdir($package);
53         my $mime=pkgfile($package,"mime");
54         
55         if ($mime ne '') {
56                 if (! -d "$tmp/usr/lib/mime/packages") {
57                         doit("install","-d","$tmp/usr/lib/mime/packages");
58                 }
59                 doit("install","-p","-m644",$mime,"$tmp/usr/lib/mime/packages/$package");
60         }
61         # Check wether we have to call update-mime (either upstream already
62         # installs a MIME information file or Debian provides one)
63         if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/lib/mime/packages")) {
64                 autoscript($package,"postinst","postinst-mime");
65                 autoscript($package,"postrm","postrm-mime")
66         }
67         
68         my $sharedmimeinfo=pkgfile($package,"sharedmimeinfo");
69         
70         if ($sharedmimeinfo ne '') {
71                 if (! -d "$tmp/usr/share/mime/packages") {
72                         doit("install", "-d", "$tmp/usr/share/mime/packages");
73                 }
74                 doit("install", "-p", "-m644", $sharedmimeinfo, "$tmp/usr/share/mime/packages/$package.xml");
75         }
76         # check wether we have to call update-mime-database (either upstream
77         # already installs a shared MIME information file or Debian provides
78         # one)
79         if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/share/mime/packages")) {
80                 autoscript($package, "postinst", "postinst-sharedmimeinfo");
81                 autoscript($package, "postrm", "postrm-sharedmimeinfo")
82         }
83 }
84
85 =head1 SEE ALSO
86
87 L<debhelper(7)>
88
89 This program is a part of debhelper.
90
91 =head1 AUTHOR
92
93 Joey Hess <joeyh@debian.org>
94
95 =cut