Re-packaging commercial software into RPM packages

gac asked:

The situation is this – I have a small CentOS 5 “cluster” (currently 7 machines, but potential for more) which run a commercially available software package that’s distributed essentially in tarball format (it’s actually a zip file with a mixture of Windows/Linux binaries and an installation shell script with no potential for automation).

I’d like to re-package this somehow into an RPM package (ideally that I can throw onto a self-hosted yum repository) in order to keep these “cluster” machines both up to date and consistent. I could do 7 manual installations, but there’s scope for error. As I understand it, I’ll need to accomplish the following tasks:

  • add a non-privileged user to the target system for running the daemon without unnecessary root privileges
  • package the binary files themselves up from the final installation location on a separate build machine (probably under /opt/package for sanity’s sake). No source is available.
  • add a firewall hole in order for the end-users to be able to communicate with the “cluster” nodes
  • add a cron task which can start the daemon on @reboot

I’m coming up with plenty of good packaging resources so far, but all are based on the traditional method (i.e. if I were the vendor packaging up my source files), rather than re-packaging a ton of binary files from an already-installed instance of the application, which is the only option available to me. Anyone have any good resources they can share for achieving this goal? Thanks!

My answer:

Just skip the %build stage in your RPM spec file, and copy the vendor’s binaries to their correct locations in the buildroot in the %install stage. Add your cron jobs and users in %post and remove them in %preun (if it’s not an upgrade; the docs you’ve already read should cover this case).

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.