Now it is time to get practical ourselves. I have a simple shell script named 'linuxstatus' which I want to install as '/usr/bin/linuxstatus'. So first let's create a directory named 'debian' next to the file 'linuxstatus'.
$ mkdir -p ./debian/usr/bin $ cp linuxstatus ./debian/usr/bin |
Let's start with the control file. The version number must have a dash with an additional Debian package version number, e.g. '1.1-1'. If your program consists e.g. only of portable shell scripts, use 'all' as its 'Architecture'.
For 'Depends' you might need to find out to which package a certain file or program your new package relies onto belongs to. There is a web page where you can search for Debian files: http://www.debian.org/distrib/packages. Go to the bottom of that page. Once you know the package name, you can get further version details of this package on your own system with 'apt-cache showpkg package'.
'Suggests', 'Conflicts', and 'Replaces' etc. can be left out if not needed.
So here is the result of our first 'control' file:
[1] |
The 'control' file gets copied into a directory called 'DEBIAN' inside the other 'debian' directory.
$ mkdir -p debian/DEBIAN $ find ./debian -type d | xargs chmod 755 # this is necessary on Debian Woody, don't ask me why $ cp control debian/DEBIAN |
If you expect your package to have a bigger audience in the future it might help to read this Writing Debian package descriptions article.
Now it is almost done. Just type:
$ dpkg-deb --build debian dpkg-deb: building package `linuxstatus' in `debian.deb'. $ mv debian.deb linuxstatus_1.1-1_all.deb |
Uh, that was all easier than expected. Now we just have to install this package on our box and we are done:
root# dpkg -i ./linuxstatus_1.1-1_all.deb |
Type 'linuxstatus' or 'ls -l /usr/bin/linuxstatus' to see if it worked. If you don't like your package any more, just type 'dpkg -r linuxstatus' and check again that the package is deinstalled. If you install a newer version you don't have to remove the old one first, thought.
If you are curious about the version numbering scheme and naming conventions for a Debian package, have a read at this section in The Debian Reference.
[1] | Package: linuxstatus Version: 1.1-1 Section: base Priority: optional Architecture: all Depends: bash (>= 2.05a-11), textutils (>= 2.0-12), awk, procps (>= \ 1:2.0.7-8), sed (>= 3.02-8), grep (>= 2.4.2-3), shellutils (>= 2.0.11-11) Maintainer: Chr. Clemens Lee <clemens@kclee.com> Description: Linux system information This script provides a broad overview of different system aspects. |