In this example I am going to create a deb package for Java SE Development Kit 6 Update 31 using the dpkg-deb command.
dpkg-deb creates a debian archive from the filesystem tree stored in directory. directory must have a DEBIAN subdirectory, which contains the control information files such as the control file itself. This directory will not appear in the binary package's filesystem archive, but instead the files in it will be put in the binary package's control information area.
First lets download the JDK from Oracle and extract it:
Since we are going to install JDK on Unutu, jdk-6u31-linux-x64 needs to go to /usr/lib/jvm, and the following symlinks needs to exist:
This means that our Debian package needs to extract the JDK distribution and create the symlinks (also remove them first if there's an older version of JDK already installed, as the symlinks will be pointing to it).
Lest create our packaging infrastructure:
The DEBIAN directory will contain the two main files that tell dpkg-deb how to build the package and what scripts to execute if any:
Now that we have everything in place let's build the package:
To install the package run:
This will extract the files to /usr/lib/jvm, and create the symlinks specified in the postinst script.