]> git.donarmstrong.com Git - debhelper.git/blob - dh_installmenu
dh_installmenus: Now that a triggers capable menu and dpkg are in stable, menu does...
[debhelper.git] / dh_installmenu
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installmenu - install debian menu 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_installmenu> [S<B<debhelper options>>] [B<-n>]
15
16 =head1 DESCRIPTION
17
18 dh_installmenu is a debhelper program that is responsible for installing
19 files used by the debian menu package into package build directories.
20
21 If a file named debian/package.menu exists, then it is installed into
22 usr/share/menu/package in the package build directory. This is a debian menu
23 file. See L<menufile(5)> for its format.
24
25 If a file named debian/package.menu-method exits, then it is installed into
26 etc/menu-methods/package in the package build directory. This is a debian
27 menu method file. In this case, dh_installmenu also automatically generates
28 the postinst and postrm commands needed to
29 interface with the debian menu package. These commands are inserted into
30 the maintainer scripts by dh_installdeb. See L<dh_installdeb(1)> for an
31 explanation of how this works.
32
33 =head1 OPTIONS
34
35 =over 4
36
37 =item B<-n>, B<--noscripts>
38
39 Do not modify postinst/postrm scripts.
40
41 =back
42
43 =cut
44
45 init();
46
47 foreach my $package (@{$dh{DOPACKAGES}}) {
48         my $tmp=tmpdir($package);
49         my $menu=pkgfile($package,"menu");
50         my $menu_method=pkgfile($package,"menu-method");
51         
52         if ($menu ne '') {
53                 if (! -d "$tmp/usr/share/menu") {
54                         doit("install","-d","$tmp/usr/share/menu");
55                 }
56                 doit("install","-p","-m644",$menu,"$tmp/usr/share/menu/$package");
57         }
58
59         if ($menu_method ne '') {
60                 if (!-d "$tmp/etc/menu-methods") {
61                         doit("install","-d","$tmp/etc/menu-methods");
62                 }
63                 doit("install","-p","-m644",$menu_method,"$tmp/etc/menu-methods/$package");
64
65                 if (! $dh{NOSCRIPTS}) {
66                         autoscript($package,"postinst","postinst-menu-method","s/#PACKAGE#/$package/");
67                         autoscript($package,"postrm","postrm-menu-method","s/#PACKAGE#/$package/");
68                 }
69         }
70 }
71
72 =head1 SEE ALSO
73
74 L<debhelper(7)>
75 L<update-menus(1)>
76 L<menufile(5)>
77
78 This program is a part of debhelper.
79
80 =head1 AUTHOR
81
82 Joey Hess <joeyh@debian.org>
83
84 =cut