5 dh_installmime - install mime files into package build directories
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installmime> [S<I<debhelper options>>] [B<-n>]
18 dh_installmime is a debhelper program that is responsible for installing
19 mime files into package build directories.
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.
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
35 =item B<-n>, B<--noscripts>
37 Do not modify postinst/postrm scripts.
43 Note that this command is not idempotent. L<dh_prep(1)> 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.
51 foreach my $package (@{$dh{DOPACKAGES}}) {
52 my $tmp=tmpdir($package);
53 my $mime=pkgfile($package,"mime");
56 if (! -d "$tmp/usr/lib/mime/packages") {
57 doit("install","-d","$tmp/usr/lib/mime/packages");
59 doit("install","-p","-m644",$mime,"$tmp/usr/lib/mime/packages/$package");
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")
68 my $sharedmimeinfo=pkgfile($package,"sharedmimeinfo");
70 if ($sharedmimeinfo ne '') {
71 if (! -d "$tmp/usr/share/mime/packages") {
72 doit("install", "-d", "$tmp/usr/share/mime/packages");
74 doit("install", "-p", "-m644", $sharedmimeinfo, "$tmp/usr/share/mime/packages/$package.xml");
76 # check wether we have to call update-mime-database (either upstream
77 # already installs a shared MIME information file or Debian provides
79 if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/share/mime/packages")) {
80 autoscript($package, "postinst", "postinst-sharedmimeinfo");
81 autoscript($package, "postrm", "postrm-sharedmimeinfo")
89 This program is a part of debhelper.
93 Joey Hess <joeyh@debian.org>