]> git.donarmstrong.com Git - debhelper.git/blob - dh_installmime
cmake: Pass CPPFLAGS in CFLAGS. Closes: #668813 Thanks, Simon Ruderich for the patch...
[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 B<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 F<postinst> and F<postrm> commands needed to
22 interface with the debian B<mime-support> and B<shared-mime-info> packages. These
23 commands are inserted into the maintainer scripts by L<dh_installdeb(1)>.
24
25 =head1 FILES
26
27 =over 4
28
29 =item debian/I<package>.mime
30
31 Installed into usr/lib/mime/packages/I<package> in the package build
32 directory.
33
34 =item debian/I<package>.sharedmimeinfo
35
36 Installed into /usr/share/mime/packages/I<package>.xml in the package build
37 directory.
38
39 =back
40
41 =head1 OPTIONS
42
43 =over 4
44
45 =item B<-n>, B<--noscripts>
46
47 Do not modify F<postinst>/F<postrm> scripts.
48
49 =back
50
51 =head1 NOTES
52
53 Note that this command is not idempotent. L<dh_prep(1)> should be called
54 between invocations of this command. Otherwise, it may cause multiple
55 instances of the same text to be added to maintainer scripts.
56
57 =cut
58
59 init();
60
61 foreach my $package (@{$dh{DOPACKAGES}}) {
62         my $tmp=tmpdir($package);
63         my $mime=pkgfile($package,"mime");
64         
65         if ($mime ne '') {
66                 if (! -d "$tmp/usr/lib/mime/packages") {
67                         doit("install","-d","$tmp/usr/lib/mime/packages");
68                 }
69                 doit("install","-p","-m644",$mime,"$tmp/usr/lib/mime/packages/$package");
70         }
71         # Check wether we have to call update-mime (either upstream already
72         # installs a MIME information file or Debian provides one)
73         if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/lib/mime/packages")) {
74                 autoscript($package,"postinst","postinst-mime");
75                 autoscript($package,"postrm","postrm-mime")
76         }
77         
78         my $sharedmimeinfo=pkgfile($package,"sharedmimeinfo");
79         
80         if ($sharedmimeinfo ne '') {
81                 if (! -d "$tmp/usr/share/mime/packages") {
82                         doit("install", "-d", "$tmp/usr/share/mime/packages");
83                 }
84                 doit("install", "-p", "-m644", $sharedmimeinfo, "$tmp/usr/share/mime/packages/$package.xml");
85         }
86         # check wether we have to call update-mime-database (either upstream
87         # already installs a shared MIME information file or Debian provides
88         # one)
89         if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/share/mime/packages")) {
90                 autoscript($package, "postinst", "postinst-sharedmimeinfo");
91                 autoscript($package, "postrm", "postrm-sharedmimeinfo")
92         }
93 }
94
95 =head1 SEE ALSO
96
97 L<debhelper(7)>
98
99 This program is a part of debhelper.
100
101 =head1 AUTHOR
102
103 Joey Hess <joeyh@debian.org>
104
105 =cut