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

Re: About creating .deb packages

On Thu, 30 Dec 2004, martin f krafft wrote:

> Unfortunately, ar(1) won't suffice as it cannot create BSD-style
> archives. DEB files are BSD ar archives, not GNU ar. Thus, you need
> dpkg-source. However, you can drop cp(1) since tar(1) (or gzip(1))
> can do that too :)


> You need a control file. Whether that is debian/control (standard
> source package), or DEBIAN/control (binary package) does not matter
> though. However, if you use debian/control, you also need
> debian/changelog.

I think you're wrong about this.  Here courtesy of my upcoming book on
Debian package management (if my son stops puking and pooping long
enough for me to finish it :-) is the minimal set of things you
need to do to create a .deb which is installable and removable by dpkg.
(Of course it is no way near policy-compliant.)

1. Here's a simple hello world program:

#include <stdio.h>
int main ()
  printf("Hello world!\n");
  return 0;

2. Type it up into a file called hello.c and compile it like this:

$ gcc -o hello hello.c

 You end up with a file called hello.

3.Make a directory structure to hold the file and move it there. Then tar
  it up with the name data.tar.gz

$ mkdir -p usr/local/bin
$ mv hello usr/local/bin
$ tar cvzf data.tar.gz ./usr

4.  Create a file called control that looks like this:

Package: hello-example
Description: A quicky and dirty example of a debian package

5. Now tar it up with the name control.tar.gz

$ tar cvzf control.tar.gz control

6. Create a file called debian-binary.

$ echo 2.0 > debian-binary

Finally, use ar to bundle up these files into one archive.  debian-binary
must be the first file in the archive

$ ar r hello-example.deb debian-binary control.tar.gz data.tar.gz

run dpkg -I dpkg -c etc. on it and you'll see it is a perfectly usable

Jaldhar H. Vyas <jaldhar@debian.org>
La Salle Debain - http://www.braincells.com/debian/

Reply to: