[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Packaging pekwm



On Sunday 05 January 2003 18:59, David Frey wrote:
> On Sun, 2003-01-05 at 18:38, Sean 'Shaleh' Perry wrote:
> > Take a look at my package for the blackbox window manager.  Should answer
> > most of your questions.  If you still have any issues please respond to
> > this thread and we can work them out.  (Let's keep it here so the next
> > person packaging a wm can search the mentors archive).
>
> That's how I got started.  I have been looking at various window manager
> packages.  I still can't figure out how my menu-method is supposed to
> get copied over.

If you look at blackbox I use debhelper for this.  Specifically 
dh_installmenu.

Here is a blurb from the man page:
<blurb>
       It also automatically generates the postinst and postrm commands needed
       to interface with the debian menu package. See dh_installdeb(1) for an
       explanation of how this works.

       If a file named debian/package.menu exists, then it is installed into
       usr/lib/menu/package in the package build directory. This is a debian
       menu file. See menufile(5L) for its format.

       If a file named debian/package.menu-method exits, then it is installed
       into etc/menu-methods/package in the package build directory. This is a
       debian menu method file.
</blurb>

The code is not too hard (see /usr/bin/dh_installmenu):
<code>
foreach my $package (@{$dh{DOPACKAGES}}) {
    my $tmp=tmpdir($package);
    my $menu=pkgfile($package,"menu");
    my $menu_method=pkgfile($package,"menu-method");

    if ($menu ne '') {
            if (! -d "$tmp/usr/lib/menu") {
                doit("install","-d","$tmp/usr/lib/menu");
            }

            doit("install","-p","-m644",$menu,"$tmp/usr/lib/menu/$package");

            # Add the scripts if a menu-method file doesn't exist.
            # The scripts for menu-method handle everything these do, too.
            if ($menu_method eq "" && ! $dh{NOSCRIPTS}) {
                autoscript($package,"postinst","postinst-menu");
                autoscript($package,"postrm","postrm-menu")
            }
    }

    if ($menu_method ne '') {
        if (!-d "$tmp/etc/menu-methods") {
            doit("install","-d","$tmp/etc/menu-methods");
        }
        doit("install","-p",$menu_method,"$tmp/etc/menu-methods/$package");

        if (! $dh{NOSCRIPTS}) {
            autoscript($package,"postinst","postinst-menu-method",
                       "s/#PACKAGE#/$package/");
            autoscript($package,"postrm","postrm-menu-method",
                       "s/#PACKAGE#/$package/");
        }
    }
}
</code>

And in /usr/share/debhelper/autoscripts:
$ cat postinst-menu-method
inst=/etc/menu-methods/#PACKAGE#
if [ -x /usr/bin/update-menus ] && [ -f $inst ] ; then
        chmod a+x $inst
        update-menus
fi

Hope all of that helps and also gives you ideas on how to track down answers 
to similar questions in the future.  Even if you choose not to use debhelper, 
Joey Hess does a great job of defining policy compliant and package 
indepedent solutions to common issues.  The code in debhelper is a worthwhile 
read.



Reply to: