]> git.donarmstrong.com Git - debhelper.git/blob - dh_installmenu
r338: * Patch from Jorgen `forcer' Schaefer <forcer at mindless.com> (much
[debhelper.git] / dh_installmenu
1 #!/usr/bin/perl -w
2 #
3 # Integration with debian menu system:
4 #
5 # If debian/menu file exists, save it to $TMP/usr/lib/menu/$PACKAGE
6 # If debian/menu-method file exists, save it to 
7 # $TMP/etc/menu-methods/$PACKAGE
8 #
9 # Also, add to postinst and postrm.
10
11 use Debian::Debhelper::Dh_Lib;
12 init();
13
14 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
15         $TMP=tmpdir($PACKAGE);
16         $menu=pkgfile($PACKAGE,"menu");
17         $menu_method=pkgfile($PACKAGE,"menu-method");
18         
19         if ($menu ne '') {
20                 if (! -d "$TMP/usr/lib/menu") {
21                         doit("install","-d","$TMP/usr/lib/menu");
22                 }
23                 doit("install","-p","-m644",$menu,"$TMP/usr/lib/menu/$PACKAGE");
24                 
25                 # Add the scripts if a menu-method file doesn't exist.
26                 # The scripts for menu-method handle everything these do, too.
27                 if ($menu_method eq "" && ! $dh{NOSCRIPTS}) {
28                         autoscript($PACKAGE,"postinst","postinst-menu");
29                         autoscript($PACKAGE,"postrm","postrm-menu")
30                 }
31         }
32
33         if ($menu_method ne '') {
34                 if (!-d "$TMP/etc/menu-methods") {
35                         doit("install","-d","$TMP/etc/menu-methods");
36                 }
37                 doit("install","-p",$menu_method,"$TMP/etc/menu-methods/$PACKAGE");
38
39                 if (! $dh{NOSCRIPTS}) {
40                         autoscript($PACKAGE,"postinst","postinst-menu-method","s/#PACKAGE#/$PACKAGE/");
41                         autoscript($PACKAGE,"postrm","postrm-menu-method","s/#PACKAGE#/$PACKAGE/");
42                 }
43         }
44 }