]> git.donarmstrong.com Git - debhelper.git/blob - dh_installmenu
r576: * Rename debhelper.1 to debhelper.7.
[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. See L<dh_installdeb(1)> for an
23 explanation of how this works.
24
25 If a file named debian/package.menu exists, then it is installed into
26 usr/lib/menu/package in the package build directory. This is a debian menu
27 file. See L<menufile(5L)> for its format.
28
29 If a file named debian/package.menu-method exits, then it is installed into
30 etc/menu-methods/package in the package build directory. This is a debian
31 menu method file.
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/lib/menu") {
54                         doit("install","-d","$tmp/usr/lib/menu");
55                 }
56                 doit("install","-p","-m644",$menu,"$tmp/usr/lib/menu/$package");
57                 
58                 # Add the scripts if a menu-method file doesn't exist.
59                 # The scripts for menu-method handle everything these do, too.
60                 if ($menu_method eq "" && ! $dh{NOSCRIPTS}) {
61                         autoscript($package,"postinst","postinst-menu");
62                         autoscript($package,"postrm","postrm-menu")
63                 }
64         }
65
66         if ($menu_method ne '') {
67                 if (!-d "$tmp/etc/menu-methods") {
68                         doit("install","-d","$tmp/etc/menu-methods");
69                 }
70                 doit("install","-p",$menu_method,"$tmp/etc/menu-methods/$package");
71
72                 if (! $dh{NOSCRIPTS}) {
73                         autoscript($package,"postinst","postinst-menu-method","s/#PACKAGE#/$package/");
74                         autoscript($package,"postrm","postrm-menu-method","s/#PACKAGE#/$package/");
75                 }
76         }
77 }
78
79 =head1 SEE ALSO
80
81 L<debhelper(7)>
82 L<update-menus(1)>
83 L<menufile(5L)>
84
85 This program is a part of debhelper.
86
87 =head1 AUTHOR
88
89 Joey Hess <joeyh@debian.org>
90
91 =cut