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. See
23 L<dh_installdeb(1)> for an explanation of how this works.
25 If files named debian/package.mime or debian/package.sharedmimeinfo exist, then
26 they are installed into usr/lib/mime/packages/package and
27 /usr/share/mime/packages/package.xml (respectively) in the package build
34 =item B<-n>, B<--noscripts>
36 Do not modify postinst/postrm scripts.
42 Note that this command is not idempotent. "dh_clean -k" should be called
43 between invocations of this command. Otherwise, it may cause multiple
44 instances of the same text to be added to maintainer scripts.
50 foreach my $package (@{$dh{DOPACKAGES}}) {
51 my $tmp=tmpdir($package);
52 my $mime=pkgfile($package,"mime");
55 if (! -d "$tmp/usr/lib/mime/packages") {
56 doit("install","-d","$tmp/usr/lib/mime/packages");
58 doit("install","-p","-m644",$mime,"$tmp/usr/lib/mime/packages/$package");
60 # Check wether we have to call update-mime (either upstream already
61 # installs a MIME information file or Debian provides one)
62 if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/lib/mime/packages")) {
63 autoscript($package,"postinst","postinst-mime");
64 autoscript($package,"postrm","postrm-mime")
67 my $sharedmimeinfo=pkgfile($package,"sharedmimeinfo");
69 if ($sharedmimeinfo ne '') {
70 if (! -d "$tmp/usr/share/mime/packages") {
71 doit("install", "-d", "$tmp/usr/share/mime/packages");
73 doit("install", "-p", "-m644", $sharedmimeinfo, "$tmp/usr/share/mime/packages/$package.xml");
75 # check wether we have to call update-mime-database (either upstream
76 # already installs a shared MIME information file or Debian provides
78 if ((! $dh{NOSCRIPTS}) && (-d "$tmp/usr/share/mime/packages")) {
79 autoscript($package, "postinst", "postinst-sharedmimeinfo");
80 autoscript($package, "postrm", "postrm-sharedmimeinfo")
88 This program is a part of debhelper.
92 Joey Hess <joeyh@debian.org>