Why Convert Package Formats

Package databases work best when as many program and other system support files (fonts, icons, and so on) as possible are installed via the distribution's primary package system. It's possible to install both RPM and Debian package systems on one computer, but using both systems is inadvisable because the databases can't communicate with one another. Thus, when you go to install a package in your distribution's non-native format, chances are the database will flag many failed dependencies, even when appropriate packages are installed using the native system.

If you can't find a program in your primary package system, you may be tempted to install the program from a tarball. These are, after all, a "universal" package format, in that all Linux systems can extract tarballs. On most distributions, though, installing a tarball means that you won't have package information in your database, nor will you be able to check that you have the appropriate support libraries (at least, not through the package system itself).

In these cases, converting a package from one format to your native format is usually preferable to trying to install a tarball, install from source code, or install using a non-native package format. You can install the converted package and gain many of the benefits of your native package format—you'll be able to check for at least some dependencies, easily uninstall the package, and so on. Using alien

The alien package relies on the presence of package tools for all of the package systems it's to support—normally at least tar, rpm, and dpkg. (One of the package databases will go unused, though; alien just needs the foreign package system to extract or create archives, not to install the archives.) Here is the basic syntax for alien:

alien [-to-deb | -to-rpm | -to-tgz | —to-slp] [options] file[...]

Each of the -to- options specifies a target format—Debian package, RPM, tarball, or Stampede package. (Stampede packages are used by Stampede Linux.) Table 11.5 summarizes some of the options you can add to modify alien's actions. In most cases, no options are required, aside from the target format specification. (Even this may be omitted if you're converting to the Debian package format.) The -description option can be useful if you're converting from a tarball, though; and -install automatically installs and then deletes the converted package.

Table 11.5: Options to Modify alien's Actions



-i or—install

Installs package after it's converted.

-g or-generate

Extracts files into a temporary directory without generating a package. You can then modify the files and generate a package using native package tools.


Sets the package description to string when converting from a tarball.


Sets the version number when converting from a tarball. (Displays the alien version number if you don't provide a package filename for conversion.)


Tries to convert scripts that run after installing or removing a package. These scripts are often distribution-specific, though, so this option may not have the desired effect.

Converting a package intended for one distribution for another one is fairly straightforward. For instance, consider converting an RPM to Debian package format:

# alien -to-deb icewm-themes-0.9.28-1.noarch.rpm icewm-themes_0.9.28-2_all.deb generated

You might perform a conversion like this if you want to install an unusual package that's not available in your native package format. Such conversions are most likely to be successful for relatively straightforward applications and libraries. Servers and packages that are unusual in any way frequently cause problems because they rely on distribution-specific startup scripts, configuration files, and the like.

Another useful application for alien is to create a package from files that aren't normally distributed in package format at all. For instance, suppose you've found a .zip file with a set of fonts you want to use on several systems. You can create an RPM package with a series of commands:

$ mkdir-p ~/to-rpm/usr/X11R6/lib/X11/fonts/newfonts $ cd ~/to-rpm/usr/X11 R6/lib/X11/fonts/newfonts $ unzip ~/newfonts.zip $ cd ~/to-rpm

$ tar cvfz newfonts.tgz usr

# alien -to-rpm -description="Newfont collection" newfonts.tgz

Note To convert to Debian format, you must run alien as root. You can create other formats as an ordinary user; however, file ownership in the resulting package may not be what you expect.

The result of this series of commands is a new file, newfonts-1-2.noarch.rpm, which contains the fonts, set to install in /usr/X11 R6/lib/X11/fonts/newfonts. You can then install the fonts using rpm and subsequently uninstall them using the same program, gaining all the benefits of the RPM database. In this specific example, you might also want to create fonts.dir and fonts.scale files, as described in Chapter 16, "Optimizing X Configuration," after extracting the original font archive and before creating the intermediary tarball. You can use a similar procedure for a commercial program that ships only as a tarball, or even that relies on an installation program—you can run the installation program, then package up the installed files (provided you know where to find them) to create an RPM or Debian package.

Team LIB

Team LiB

^ previous

0 0

Post a comment