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
Written by Jannich Brendle tor 11 juni 2009 In How to