Tuesday, February 16, 2010

Converting .rpm format kits to .deb format

One of the main obstacles to moving smoothly between the Fedora/RedHat and Ubuntu/Debian variants of Linux is the fact that the former use kits in .rpm format and the later use kits in the .deb format. If you are using Ubuntu, but your favourite product (e.g. Sametime) only ships in .rpm format you need some way to convert the .rpm format kits into .deb format before you install them

Luckily there is a tool called alien which can do the conversion for you. Alien is not installed by default, but you can easily install it with the command "sudo apt-get install alien". After installing alien you can easily convert a .rpm format kit into a .deb format kit with a single command (e.g. "fakeroot alien -d -k --scripts kitname.rpm" will produce a file kitname.deb which can be installed on an Ubuntu system).

Unfortunately things are not always that simple, because some kits contain hidden dependencies on the RedHat flavour of Linux. For example the pre-install script in the Sametime kits normally checks for dependencies by issuing a "rpm -qa" command and then parsing the output to see if the necessary pre-requisites products are installed. Naturally this code will not work on a Ubuntu system and so you will need to unpack the kit, fix the installer code and then rebuild the kit.

The steps you need to follow are
  1. Unpack the kit to reverse engineer the build environment.
    1. The files to build a kit should be placed in a directory with the same name as the name of the kit you are going to build.
    2. Right click on the .deb file created by alien and you will see the option to open it with archive manager.
    3. You will see that the kit .deb archive contains three files:
      1. debian-binary is a file which identifies the version of dpkg used to build this kit. Don't worry about this file, it will be automatically generated when you build the new kit
      2. data.tar.gz is an archive containing the files which will be installed on the target system. You should extract the contents of this file into your kit build environment directly under the sub-directory with the name of the kit
      3. control.tar.gz - This archive contains files used as part of the install script. These files should be extracted to a sub-directory named DEBIAN. One file named control contains information about the kit, its dependencies etc., the rest of the files are shell scripts which get called as part of the install program. The scripts are optional, but if present they will have a name which gives you a good clue about when they are invoked e.g. the file predoinst.sh shell script s called before the kit gets installed.
  2. Fix the problem - I can't give detailed instructions here. because each case is different.
  3. Rebuilding the kit can be done with the command "dpkg -b kitname"
If you want (or need) to learn more about building Debian format kits, you should read this tutorial.

No comments:

Post a Comment