A metapackage is a package which do not contain any files to be installed. Instead it have dependencies to other packages. There are several uses for metapackages, I use them for easy installation of packages I often use, when installing debian or xubuntu on a new computer.

So just for this guide, I am going to make the metapackage depend on some of the packages I use:

  • mc
  • audacious
  • erlang-base
  • lynx
  • geany
  • sshfs
  • dsniff
  • aircrack-ng
  • nmap
  • wine

First of, you need to make the directory structure to hold the files for your metapackage. The directory’s name should be the same as the package name. In this example, the package name is bredsaal-laptop:

mkdir -p ~/packages/bredsaal-laptop/DEBIAN

Now create the two files necesary for the metapackage to build:

cd ~/packages/bredsaal-laptop/DEBIAN; touch postinst; touch control

Insert the following text into the control file:

Package: bredsaal-laptop
Version: 0.1
Section: main
Priority: optional
Architecture: all
Depends: mc, audacious, erlang-base, lynx, geany, sshfs, dsniff, aircrack-ng, nmap, wine
Installed-Size:
Maintainer: Jannich Brendle
Description: A metapackage just for me.

And this text into the postinst file:

#!/bin/sh
# postinst script for bredsaal_laptop
#
# see: dh_installdeb(1)
set -e

case "$1" in
configure)
## Perhaps something needs to be configured in the future.
echo "Congratulations."
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument `$1'" >&2
exit 1
;;
esac

#DEBHELPER#

exit 0

Now, to gererate your metapackage:

cd ~/packages/; chmod 555 bredsaal-laptop/DEBIAN/postinst; dpkg-deb -b bredsaal-laptop bredsaal-laptop.deb

Now, your package should build and be ready to install like this:

sudo gdebi bredsaal-laptop.deb

Related posts:

Tags: , ,

7 Comments to “A quick guide to debian metapackages”

  1. ghostbit says:

    Thank you… needed to know how to build the control file.

  2. seo packages says:

    Hi Jannich, it seems this is not really for beginners in debian, is it?

  3. My name is Piter Jankovich. oOnly want to tell, that your blog is really cool
    And want to ask you: is this blog your hobby?
    P.S. Sorry for my bad english

  4. @Seo Packages: Well, I guess it could be easier, but it’s not really that hard to make a meta-package, if you just follow the instructions above. :-)

    @PiterJankovich: Thanks a lot. And yes, my blog is a hobby, and I don’t really make any money off of it. :-)

  5. Grant Laden from download true blood says:

    It’s a great guide, no doubt i’ll do it wrong a thousand times and come back to bother you.

  6. You’re more than welcome Grant. :-)

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.