Convert your packages from Debian to RPM with alien

package-managersThere are situations in which some of your required software packages are not available from standard repositories configured by default. During those times we attempt to download the corresponding .rpm or .deb package accordingly based on our OS type. What if a particular application is not available in you OS-supported package type? I think its better if I explain how I hacked in such a situation to get rid of the problem.

I used to play the famous “2048” android game in my friend’s Moto-G. As days passed, I thought of having this game on my laptop [so that my friend is not more disturbed]. Then I decided to search for the particular rpm package [since I use fedora 20 at present]. After a long web search, I couldn’t find the rpm package for 2048 instead I ended up with the corresponding debian package. What can I do? Again a web search helped me in finding this tool named ALIEN.

About Alien [from man page]
alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats. If you want to use a package from another linux distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it.

Installing Alien
Download the tar ball from http://ftp.de.debian.org/debian/pool/main/a/alien/alien_8.92.tar.gz. Then extract the tar ball. Make sure that you have all the pre-requisites installed on your system, specified in the README file.

# tar xzf alien_8.92.tar.gz

Change to extracted directory and run the following

# perl Makefile.PL
# make
# make install

Steps for converting .deb to .rpm
Following the installation, I made a look through the man page and somehow figured out, how to convert a debian package to the corresponding rpm style. Just one step and you are done.
Note:- Replace .deb file with your corresponding debian package.

# alien -r 2048_1_all.deb
2048-1-2.noarch.rpm generated

Now I tried to install the generated rpm using the rpm command as follows

# rpm -ivh 2048-1-2.noarch.rpm
Preparing…                          ################################# [100%]
    file / from install of 2048-1-2.noarch conflicts with file from package filesystem-3.2-19.fc20.x86_64

What the hell? There were some errors in converting to rpm !! In such cases you may have to rebuild the rpm using the rpmrebuild command as follows [you may need to install rpmrebuild].

# rpmrebuild -pe 2048-1-2.noarch.rpm

On my system lvm was configured during installation in such a way that root file system is mounted on /. So we don’t need to externally specify the permission attributes for / in spec file. Now edit the spec file displayed by deleting/commenting the following line, save and quit the editor.

%dir %attr(0755, root, root) “/”

Note:- If a similar error is shown for you, check for the permission attributes of specfied directories on your system with the one written in the spec file displayed in the editor. Remove the wrong directory entries starting with %dir %attr. Then enter “y” at the prompt shown next.

Do you want to continue ? (y/N) y
result: /root/rpmbuild/RPMS/noarch/2048-1-2.noarch.rpm

Install the newely generated rpm as mentioned above. Now I could play the game offline whenever I want. Feel free to comment on any difficulties you face while executing the above steps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s