Search code examples
scriptingcentosdebianredhatrpm

How to easily convert Debian script to RPM script?


I'm aiming to translate a Debian package to an RPM package to install it on a CentOS Linux 7 (Red Hat).
I used alien to accomplish it: alien --to-rpm --scripts --keep-version debian_pkg.deb. However, when I want to install the created rpm package, an error is raised from the preinst script. I saw online that there is a high likelihood that scripts written for Debian packages won’t work for RPM packages.

Is there an easy way to translate a Debian script to an RPM script? If not, is there any common patterns when you want to do the conversion?

Thanks!


Solution

  • As I learned it through the process, there is no easy way to translate a Debian package to an RPM package. You need to go through your scripts and translate them manually. To do so, you need to execute alien --to-rpm --scripts --generate debian_pkg.deb, it creates a temporary directory suitable for building a package from. You find your scripts inside the .spec file. If somebody encounters this problem, here is some documentation that helped me a lot: RPM Packaging guide and Building and distributing packages.