I build an RPM using fpm for EL6 hosts. It installs a /etc/init.d script. However if that package is installed on an EL7 host, I want it to install a file in /usr/lib/systemd/system instead.
Is there an easy way to tell FPM to make an RPM that will install different files on different operating systems?
If not, is it safe to install both and assume that EL6 hosts will ignore the systemd file, and EL7 hosts will ignore the /etc/init.d script?
just deliver your startup scripts (so the 'init' and the 'systemd' scripts) along with your other files - and not directly to the 'init.d' respectively 'systemd' folder. then detect in the post-install phase (e.g. via the "/etc/redhat-release") whether you are on EL6 or on EL7 and then copy the relevant startup script accordingly ...