Issue
I created an RPM with nfpm. When the RPM is installed on an OEL 7.x system, it requires me to reload the unit files, before I can start the service.
systemctl daemon-reload
How would I do allow the RPM to reload, so that the service can be started, and also be enabled on reboots?
Since this may be nfpm config (YAML) specific, I wouldn't mind the native RPM spec file perspective either.
Thanks in advance.
Solution
you could put that in the %post
section:
%post
systemctl daemon-reload
While we are at it, here are some good practices that I found for cleanup when your package is uninstalled:
%preun
if [ $1 == 0 ]; then #uninstall
systemctl unmask %{name}.service
systemctl stop %{name}.service
systemctl disable %{name}.service
fi
%postun
if [ $1 == 0 ]; then #uninstall
systemctl daemon-reload
systemctl reset-failed
fi
Answered By - Chris Maes Answer Checked By - Marie Seifert (WPSolving Admin)