|
How-To
Make binary .deb
packages
The easiest way to illustrate how to do this is probably to dismantle
an existing package, and then put it back together again.... So
that's what we'll do now... First we'll need to grab a good example
package... cd into somewhere sensible, then then
wget http://intimate.handhelds.org/debian/dists/unstable/main/binary-arm/x11/wmsmixer_0.5_arm.deb
OK..
next, we'll create a directory to work in.. as we're playing with
the wmsmixer package, let's make call our dir 'wmsmixer'
mkdir wmsmixer &&
cd wmsmixer
- Now let's extract
the package we downloaded, and put it into some kind of order
ar -x ../wmsmixer_0.5_arm.deb
rm debian-binary
tar xvzf data.tar.gz
&& rm data.tar.gz
mkdir DEBIAN
&& cd DEBIAN
tar xvzf ../control.tar.gz
&& rm ../control.tar.gz
OK... now we've got a binary pacakge
source tree... at any time we can turn this source tree into a package
by cd-ing to the right place and using 'dpkg-deb -b wmsmixer wmsmixer_0.5_arm.deb'
and it'll produce a .deb package for us. We can test that package
out using 'dpkg -i <packagename>'
Now, let's have a closer look at
what's in the package archive...
- intimate:~/wmsmixer#
find . -type f
./usr/lib/menu/wmsmixer
./usr/X11R6/bin/wmsmixer
./DEBIAN/control
./DEBIAN/postinst
./DEBIAN/postrm
We have only 5 files in this archive.. The wmsmixer
binary itself in usr/X11R6/bin, the 'debian menu system' entry for
wmsmixer in usr/lib/menu, and the package control files in the DEBIAN
dir. In this archive, the postinst and postrm files simply call
update-menus, which, providing that the debian menu package is installed
will parse through /usr/lib/menu, and generate menus for any window
managers that are installed. The format of the usr/lib/menu/wmsmixer
file is fairly obvious if you look at it.. you can have multiple
menu items in the same file BTW. (You can always do man menufileif
you want to find out more)
Lastly is the 'control'
file.. Let's take a look in there....
intimate:~/wmsmixer#
cat DEBIAN/control
Package: wmsmixer
Priority: optional
Version: 0.5
Architecture: arm
Maintainer: James Conner <jim@secret.org.uk>
Depends: libc6, xlibs
Description: Dockapp mixer thing.. Looks quite nice
The format in the control file is fairly self explanitory.
Packages may have Depends, Provides, Conflicts etc as fields. An
empty field is not allowed. For example, if this package had no
dependencies, then there should be no Depends: line. An empty line
confuses the packaging system.
Let's change something in this package then...
Let's change the location in the menus that wmsmixer will appear
in... Here's the contents of usr/lib/menu/wmsmixer
intimate:~/wmsmixer#
cat usr/lib/menu/wmsmixer
?package(wmsmixer):\
needs="x11"\
section="Apps/Sound"\
title="WMSmixer (Docked)"\
command="/usr/X11R6/bin/wmsmixer -s -w"
?package(wmmixer):\
needs="x11"\
section="Apps/Sound"\
title="WMSmixer"\
command="/usr/X11R6/bin/wmsmixer -s"
Edit the file so that both the section lines are
changed from "Apps/Sound" to "Games/Toys".
Next we need to update the version number in the
DEBIAN/control file so that the packaging system will recognise
it as a new version. Edit the control file and change the Version:
number from 0.5 to 0.5-1.
Next, we'll build our new package...
intimate:~# dpkg-deb
-b wmsmixer wmsmixer_0.5-1_arm.deb
dpkg-deb: building package `wmsmixer' in
`wmsmixer_0.5-1_arm.deb'.
And finally, we'll test our new package...
intimate:~#
dpkg -i ./wmsmixer_0.5-1_arm.deb
(Reading database ... 8811 files and directories
currently installed.)
Preparing to replace wmsmixer 0.5 (using ./wmsmixer_0.5-1_arm.deb)
...
Unpacking replacement wmsmixer ...
Setting up wmsmixer (0.5-1) ...
We have success!!!!
Well.. hopefully, that should get you all started
making packages for yourselves. Don't forget to send the packages
to one of the intimate developers so that everybody can enjoy your
hard work. Thanks :)
|