I have just completed my first .deb package, that can be installed on Debian and Ubuntu with a couple of clicks, and I need to write down a short note as a reminder for future packetizations.
First of all, create a directory that will have the name of your package, e.g. my-program_1.0_i386, and copy all the binary files you need into it, using their absolute paths as relative paths.
For instance, if the program executable is /usr/bin/pippo, then you will copy this file into my-program_1.0_i386/usr/bin/pippo and you have to repeat this step for all the files (including the ones under /etc and so forth).
Since the package will not include only files but also configuration informations, create a DEBIAN subdir and fill it with the following files:
- control: is the most important control file, analyzed later
- conffiles: list of absolute paths of files (one each line) that you are going to install and that have to be considered as configuration files (this is why Synaptic shows two different kind of uninstallations)
- preinst: executable script executed before copying the files
- postinst: script executed after file copy
- prerm: script executed before file removal on uninstall
- postrm: script executed after file removal
The four executable scripts can be written in the language you prefer, probably they will be bash shell script files.
The control file will then have relative path my-program_1.0_i386/DEBIAN/control and it will be a text file that will include the following informations:
Depends: sed, libncurses4
Maintainer: Fabrizio Fazzino <email@example.com>
Description: My Program
This is the long description for My Program.
Please indent this description with one blank space at the beginning
of each line and use a full stop alone on a line to leave a break:
* Unordered lists are obtained...
* ...by placing an asterisk at the beginning of a line.
The installed size must be reported in KByte (so in the example you must know that the files you are copying are about 12 MBytes).
When you think that everything is OK, just run the command dpkg -b my-program_1.0_i386 from the upper directory and it will create a file named my-program_1.0_i386.deb for you.
Now you are ready to try to install and uninstall it several times from the command line (with dpkg) or from the GUI (with GDebi or Synaptic).
When you're sure that it's OK you can share it with the world, or at least to save it for future installations.