redhat: Fix install (daemon selection) and make postun scripts compatible with fedora

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
Martin Winter 2017-04-14 01:28:13 -07:00 committed by Donald Sharp
parent 63ef966e65
commit da69cb8e75

View File

@ -395,7 +395,9 @@ for daemon in %all_daemons ; do
done done
%else %else
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
/sbin/chkconfig --add ${daemon} if [ x"${daemon}" != x"" ] ; then
/sbin/chkconfig --add ${daemon}
fi
done done
%endif %endif
@ -410,11 +412,13 @@ if [ ! -e %{_sysconfdir}/zebra.conf ]; then
chmod 640 %{_sysconfdir}/zebra.conf chmod 640 %{_sysconfdir}/zebra.conf
fi fi
for daemon in %{all_daemons} ; do for daemon in %{all_daemons} ; do
if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then if [ x"${daemon}" != x"" ] ; then
touch %{_sysconfdir}/${daemon}.conf if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then
%if 0%{?frr_user:1} touch %{_sysconfdir}/${daemon}.conf
chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf* %if 0%{?frr_user:1}
%endif chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf*
%endif
fi
fi fi
done done
%if %{with_watchfrr} %if %{with_watchfrr}
@ -434,10 +438,12 @@ fi
if [ "$1" -ge 1 ]; then if [ "$1" -ge 1 ]; then
# Find out which daemons need to be restarted. # Find out which daemons need to be restarted.
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
if [ -f /var/lock/subsys/${daemon} ]; then if [ x"${daemon}" != x"" ] ; then
eval restart_${daemon}=yes if [ -f /var/lock/subsys/${daemon} ]; then
else eval restart_${daemon}=yes
eval restart_${daemon}=no else
eval restart_${daemon}=no
fi
fi fi
done done
# Rename restart flags for daemons handled specially. # Rename restart flags for daemons handled specially.
@ -456,18 +462,24 @@ if [ "$1" -ge 1 ]; then
# #
# Stop all daemons other than zebra. # Stop all daemons other than zebra.
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
eval restart=\$restart_${daemon} if [ x"${daemon}" != x"" ] ; then
[ "$restart" = yes ] && \ eval restart=\$restart_${daemon}
%systemd_postun ${daemon}.service [ "$restart" = yes ] && \
%systemd_postun ${daemon}.service
:
fi
done done
# Restart zebra. # Restart zebra.
[ "$running_zebra" = yes ] && \ [ "$running_zebra" = yes ] && \
%systemd_postun_with_restart $daemon.service %systemd_postun_with_restart $daemon.service
# Start all daemons other than zebra. # Start all daemons other than zebra.
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
eval restart=\$restart_${daemon} if [ x"${daemon}" != x"" ] ; then
[ "$restart" = yes ] && \ eval restart=\$restart_${daemon}
%systemd_post ${daemon}.service [ "$restart" = yes ] && \
%systemd_post ${daemon}.service
:
fi
done done
%else %else
## ##
@ -480,18 +492,22 @@ if [ "$1" -ge 1 ]; then
%endif %endif
# Stop all daemons other than zebra and watchfrr. # Stop all daemons other than zebra and watchfrr.
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
eval restart=\$restart_${daemon} if [ x"${daemon}" != x"" ] ; then
[ "$restart" = yes ] && \ eval restart=\$restart_${daemon}
/etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 [ "$restart" = yes ] && \
/etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
fi
done done
# Restart zebra. # Restart zebra.
[ "$running_zebra" = yes ] && \ [ "$running_zebra" = yes ] && \
/etc/rc.d/init.d/zebra restart >/dev/null 2>&1 /etc/rc.d/init.d/zebra restart >/dev/null 2>&1
# Start all daemons other than zebra and watchfrr. # Start all daemons other than zebra and watchfrr.
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
eval restart=\$restart_${daemon} if [ x"${daemon}" != x"" ] ; then
[ "$restart" = yes ] && \ eval restart=\$restart_${daemon}
/etc/rc.d/init.d/${daemon} start >/dev/null 2>&1 [ "$restart" = yes ] && \
/etc/rc.d/init.d/${daemon} start >/dev/null 2>&1
fi
done done
%if %{with_watchfrr} %if %{with_watchfrr}
# Start watchfrr last. # Start watchfrr last.
@ -509,7 +525,9 @@ fi
## ##
if [ "$1" = "0" ]; then if [ "$1" = "0" ]; then
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
%systemd_preun ${daemon}.service if [ x"${daemon}" != x"" ] ; then
%systemd_preun ${daemon}.service
fi
done done
fi fi
%else %else
@ -518,8 +536,10 @@ fi
## ##
if [ "$1" = "0" ]; then if [ "$1" = "0" ]; then
for daemon in %all_daemons ; do for daemon in %all_daemons ; do
/etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 if [ x"${daemon}" != x"" ] ; then
/sbin/chkconfig --del ${daemon} /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
/sbin/chkconfig --del ${daemon}
fi
done done
fi fi
%endif %endif