spec: Fix rhel/suse conditiations with {pre,post}un.

Refs #6446
Refs #6374
This commit is contained in:
Michael Friedrich 2014-06-10 13:46:45 +02:00
parent 78e4b28006
commit aed88c632c

View File

@ -274,9 +274,10 @@ getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacm
getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user}
exit 0 exit 0
%post
# suse # suse
%if 0%{?suse_version} %if 0%{?suse_version}
%post
%{fillup_and_insserv icinga2} %{fillup_and_insserv icinga2}
if [ ${1:-0} -eq 1 ] if [ ${1:-0} -eq 1 ]
@ -286,24 +287,9 @@ then
fi fi
exit 0 exit 0
%postun
%restart_on_update icinga2
%insserv_cleanup
if [ "$1" = "0" ]; then
# deinstallation of the package - remove enabled features
rm -rf %{_sysconfdir}/%{name}/features-enabled
fi
exit 0
%preun
%stop_on_removal icinga2
# rhel
%else %else
# rhel
%post
/sbin/chkconfig --add icinga2 /sbin/chkconfig --add icinga2
if [ ${1:-0} -eq 1 ] if [ ${1:-0} -eq 1 ]
@ -314,7 +300,26 @@ fi
exit 0 exit 0
%endif
# suse/rhel
%postun %postun
# suse
%if 0%{?suse_version}
%restart_on_update icinga2
%insserv_cleanup
if [ "$1" = "0" ]; then
# deinstallation of the package - remove enabled features
rm -rf %{_sysconfdir}/%{name}/features-enabled
fi
exit 0
%else
# rhel
if [ "$1" -ge "1" ]; then if [ "$1" -ge "1" ]; then
/sbin/service icinga2 condrestart >/dev/null 2>&1 || : /sbin/service icinga2 condrestart >/dev/null 2>&1 || :
fi fi
@ -325,14 +330,25 @@ if [ "$1" = "0" ]; then
fi fi
exit 0 exit 0
%endif
# suse / rhel
%preun %preun
# suse
%if 0%{?suse_version}
%stop_on_removal icinga2
%else
# rhel
if [ "$1" = "0" ]; then if [ "$1" = "0" ]; then
/sbin/service icinga2 stop > /dev/null 2>&1 /sbin/service icinga2 stop > /dev/null 2>&1
/sbin/chkconfig --del icinga2 /sbin/chkconfig --del icinga2
fi fi
%endif %endif
# suse/rhel # suse / rhel
%post ido-mysql %post ido-mysql
if [ ${1:-0} -eq 1 ] if [ ${1:-0} -eq 1 ]