I started creating RPM packages for our software, but I am not confident that I am using the system as intended. I would like to create an RPM spec / source package, that I can build on different RPM systems, e.g. fedora, centos and opensuse (which is what I like about rpm).
However, I am starting to realize that many of the scripts in e.g. %pre
and %post
depend on the distribution. For example, my pre script stops Apache:
service httpd stop
However, this command doesn't work on OpenSUSE. This is just one example, there are many other things in my script that are different between distributions.
So what is the usual way to go about this? Should I just create separate .spec files for each distribution? Or are there tricks to make things portable?