Spec file fixes for opensuse, preun macro, conditionals.

Fixes #6446
This commit is contained in:
Michael Friedrich 2014-06-11 15:52:41 +02:00
parent b4248123f7
commit 64bdc7602a

View File

@ -274,23 +274,22 @@ 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 # all restart/feature actions belong to icinga2-bin
%post bin
# suse # suse
%if 0%{?suse_version} %if 0%{?suse_version}
%{fillup_and_insserv icinga2} %fillup_and_insserv %{name}
if [ ${1:-0} -eq 1 ] # initial installation, enable default features
then %{_sbindir}/icinga2-enable-feature checker notification mainlog
# initial installation, enable default features
%{_sbindir}/icinga2-enable-feature checker notification mainlog
fi
exit 0 exit 0
%else %else
# rhel # rhel
/sbin/chkconfig --add icinga2 /sbin/chkconfig --add %{name}
if [ ${1:-0} -eq 1 ] if [ ${1:-0} -eq 1 ]
then then
@ -303,11 +302,11 @@ exit 0
%endif %endif
# suse/rhel # suse/rhel
%postun %postun bin
# suse # suse
%if 0%{?suse_version} %if 0%{?suse_version}
%restart_on_update icinga2 %restart_on_update %{name}
%insserv_cleanup %insserv_cleanup
if [ "$1" = "0" ]; then if [ "$1" = "0" ]; then
@ -321,7 +320,7 @@ exit 0
# rhel # rhel
if [ "$1" -ge "1" ]; then if [ "$1" -ge "1" ]; then
/sbin/service icinga2 condrestart >/dev/null 2>&1 || : /sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi fi
if [ "$1" = "0" ]; then if [ "$1" = "0" ]; then
@ -333,20 +332,26 @@ exit 0
%endif %endif
# suse / rhel # suse / rhel
%preun %preun bin
# suse # suse
%if 0%{?suse_version} %if 0%{?suse_version}
%stop_on_removal icinga2 if [ "$1" = "0" ]; then
%stop_on_removal %{name}
fi
exit 0
%else %else
# rhel # rhel
if [ "$1" = "0" ]; then if [ "$1" = "0" ]; then
/sbin/service icinga2 stop > /dev/null 2>&1 /sbin/service %{name} stop > /dev/null 2>&1 || :
/sbin/chkconfig --del icinga2 /sbin/chkconfig --del %{name} || :
fi fi
exit 0
%endif %endif
# suse / rhel # suse / rhel