diff options
-rw-r--r-- | gala-anteater.spec | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gala-anteater.spec b/gala-anteater.spec index d8aceaf..89bc162 100644 --- a/gala-anteater.spec +++ b/gala-anteater.spec @@ -33,20 +33,24 @@ Python3 package of gala-anteater %install %py3_install -%pre -if [ -f "%{_unitdir}/gala-anteater.service" ] ; then - systemctl enable gala-anteater.service || : -fi - %post -%systemd_post gala-anteater.service +if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then + # Initial installation + /usr/lib/systemd/systemd-update-helper install-system-units gala-anteater.service || : +fi %preun -%systemd_preun gala-anteater.service +if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then + # Package removal, not upgrade + /usr/lib/systemd/systemd-update-helper remove-system-units gala-anteater.service || : +fi %postun if [ -f "%{_unitdir}/gala-anteater.service" ] ; then - %systemd_postun_with_restart gala-anteater.service + if [ $1 -ge 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then + # Package upgrade, not uninstall + /usr/bin/systemctl try-restart gala-anteater.service || : + fi fi %files |