]> git.donarmstrong.com Git - debhelper.git/blob - dh_installmenu
r1968: * dh_fixperms: Make all files in /usr/include 644, not only .h files.
[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 It also automatically generates the postinst and postrm commands needed to
22 interface with the debian menu package. These commands are inserted into
23 the maintainer scripts by dh_installde. See L<dh_installdeb(1)> for an
24 explanation of how this works.
25
26 If a file named debian/package.menu exists, then it is installed into
27 usr/share/menu/package in the package build directory. This is a debian menu
28 file. See L<menufile(5)> for its format.
29
30 If a file named debian/package.menu-method exits, then it is installed into
31 etc/menu-methods/package in the package build directory. This is a debian
32 menu method file.
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item B<-n>, B<--noscripts>
39
40 Do not modify postinst/postrm scripts.
41
42 =back
43
44 =cut
45
46 init();
47
48 foreach my $package (@{$dh{DOPACKAGES}}) {
49         my $tmp=tmpdir($package);
50         my $menu=pkgfile($package,"menu");
51         my $menu_method=pkgfile($package,"menu-method");
52         
53         if ($menu ne '') {
54                 if (! -d "$tmp/usr/share/menu") {
55                         doit("install","-d","$tmp/usr/share/menu");
56                 }
57                 doit("install","-p","-m644",$menu,"$tmp/usr/share/menu/$package");
58                 
59                 # Add the scripts if a menu-method file doesn't exist.
60                 # The scripts for menu-method handle everything these do, too.
61                 if ($menu_method eq "" && ! $dh{NOSCRIPTS}) {
62                         autoscript($package,"postinst","postinst-menu");
63                         autoscript($package,"postrm","postrm-menu")
64                 }
65         }
66
67         if ($menu_method ne '') {
68                 if (!-d "$tmp/etc/menu-methods") {
69                         doit("install","-d","$tmp/etc/menu-methods");
70                 }
71                 doit("install","-p","-m644",$menu_method,"$tmp/etc/menu-methods/$package");
72
73                 if (! $dh{NOSCRIPTS}) {
74                         autoscript($package,"postinst","postinst-menu-method","s/#PACKAGE#/$package/");
75                         autoscript($package,"postrm","postrm-menu-method","s/#PACKAGE#/$package/");
76                 }
77         }
78 }
79
80 =head1 SEE ALSO
81
82 L<debhelper(7)>
83 L<update-menus(1)>
84 L<menufile(5)>
85
86 This program is a part of debhelper.
87
88 =head1 AUTHOR
89
90 Joey Hess <joeyh@debian.org>
91
92 =cut