# rpms again and again on the same day, so the newer rpms can be installed.
# bumping the number each time.
-####################### FRRouting (FRR) configure options #########################
+#################### FRRouting (FRR) configure options #####################
# with-feature options
%{!?with_tcp_zebra: %global with_tcp_zebra 0 }
%{!?with_pam: %global with_pam 0 }
%{!?with_ospfapi: %global with_ospfapi 1 }
%{!?with_irdp: %global with_irdp 1 }
%{!?with_rtadv: %global with_rtadv 1 }
-%{!?with_mpls: %global with_mpls 0 }
-%{!?with_ldpd: %global with_ldpd 0 }
+%{!?with_ldpd: %global with_ldpd 1 }
%{!?with_shared: %global with_shared 1 }
%{!?with_multipath: %global with_multipath 256 }
%{!?frr_user: %global frr_user frr }
%{expand: %%global rpmversion %(echo '@VERSION@' | tr [:blank:]- _ )}
%define frrversion @VERSION@
-#### Check version of texi2html
-# Old versions don't support "--number-footnotes" option.
-%{expand: %%global texi2htmlversion %(/usr/bin/texi2html --version | cut -d. -f1)}
-
#### Check for systemd or init.d (upstart)
# Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7)
-%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)}
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
+ %global initsystem systemd
+%else
+%if (0%{?fedora} && 0%{?fedora} < 15) || (0%{?rhel} && 0%{?rhel} < 7)
+ %global initsystem upstart
+%else
+ %{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `readlink -f /sbin/init` = /usr/lib/systemd/systemd ]]; then echo systemd; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)}
+%endif
+%endif
#
# If init system is systemd, then always disable watchfrr
#
#### Check for RedHat 6.x or CentOS 6.x - they are too old to support PIM.
#### Always disable it on these old systems unconditionally
-%{expand: %%global redhat6 %(if [[ `cat /etc/redhat-release 2> /dev/null` =~ release\ 6\. ]]; then echo 6; else echo 0; fi)}
#
-# if CentOS 6 / RedHat 6, then disable PIMd
-%if "%{redhat6}" == "6"
+# if CentOS / RedHat and version < 7, then disable PIMd (too old, won't work)
+%if 0%{?rhel} && 0%{?rhel} < 7
%global with_pimd 0
%endif
Group: System Environment/Daemons
Source0: http://www.frrouting.org/releases/frr/%{name}-%{frrversion}.tar.gz
URL: http://www.frrouting.org
-Requires: ncurses json-c
Requires(pre): /sbin/install-info
Requires(preun): /sbin/install-info
Requires(post): /sbin/install-info
-BuildRequires: texi2html texinfo autoconf automake patch libcap-devel groff
+BuildRequires: gcc texi2html texinfo patch libcap-devel groff
BuildRequires: readline readline-devel ncurses ncurses-devel
-BuildRequires: json-c-devel bison >= 2.7 flex
-Requires: ncurses initscripts
+BuildRequires: json-c-devel bison >= 2.7 flex make
+Requires: ncurses json-c initscripts
%if %{with_pam}
BuildRequires: pam-devel
Requires: pam
%endif
--enable-vtysh \
%if %{with_ospfclient}
- --enable-ospfclient=yes \
+ --enable-ospfclient \
%else
- --enable-ospfclient=no\
+ --disable-ospfclient\
%endif
%if %{with_ospfapi}
--enable-ospfapi=yes \
%else
--enable-rtadv=no \
%endif
-%if %{with_mpls}
- --enable-mpls=yes \
-%else
- --disable-mpls \
-%endif
%if %{with_ldpd}
--enable-ldpd \
%else
%else
--disable-bgp-vnc \
%endif
- --enable-gcc-rdynamic \
--enable-isisd=yes \
%if "%{initsystem}" == "systemd"
--enable-systemd=yes \
make %{?_smp_mflags} MAKEINFO="makeinfo --no-split"
pushd doc
-%if %{texi2htmlversion} < 5
+if [ $(texi2html --version | cut -d. -f1) -lt 5 ]; then
texi2html --number-sections frr.texi
-%else
+else
texi2html --number-footnotes --number-sections frr.texi
-%endif
+fi
popd
%install
%else
mkdir -p %{buildroot}/etc/rc.d/init.d
install %{zeb_rh_src}/frr.init \
+ %{buildroot}%{_sbindir}/frr
+ln -s %{_sbindir}/frr \
%{buildroot}/etc/rc.d/init.d/frr
%endif
/sbin/chkconfig --add frr
%endif
+# Fix bad path in previous config files
+# Config files won't get replaced by default, so we do this ugly hack to fix it
+%__sed -i 's|/etc/init.d/|%{_sbindir}/|g' %{_sysconfdir}/daemons 2> /dev/null || true
+
/sbin/install-info %{_infodir}/frr.info.gz %{_infodir}/dir
# Create dummy files if they don't exist so basic functions can be used.
%postun
if [ "$1" -ge 1 ]; then
- # Find out which daemons need to be restarted.
- for daemon in %all_daemons ; do
- if [ x"${daemon}" != x"" ] ; then
- if [ -f /var/lock/subsys/${daemon} ]; then
- eval restart_${daemon}=yes
- else
- eval restart_${daemon}=no
- fi
- fi
- done
- # Rename restart flags for daemons handled specially.
- running_zebra="$restart_zebra"
- restart_zebra=no
- %if %{with_watchfrr}
- running_watchfrr="$restart_watchfrr"
- restart_watchfrr=no
- %endif
-
+ #
+ # Upgrade from older version
+ #
%if "%{initsystem}" == "systemd"
##
## Systemd Version
##
- # No watchfrr for systemd version
- #
- # Stop all daemons other than zebra.
- for daemon in %all_daemons ; do
- if [ x"${daemon}" != x"" ] ; then
- eval restart=\$restart_${daemon}
- [ "$restart" = yes ] && \
- %systemd_postun ${daemon}.service
- :
- fi
- done
- # Restart zebra.
- [ "$running_zebra" = yes ] && \
- %systemd_postun_with_restart $daemon.service
- # Start all daemons other than zebra.
- for daemon in %all_daemons ; do
- if [ x"${daemon}" != x"" ] ; then
- eval restart=\$restart_${daemon}
- [ "$restart" = yes ] && \
- %systemd_post ${daemon}.service
- :
- fi
- done
+ %systemd_postun frr.service
%else
##
## init.d Version
##
- %if %{with_watchfrr}
- # Stop watchfrr first.
- [ "$running_watchfrr" = yes ] && \
- /etc/rc.d/init.d/watchfrr stop >/dev/null 2>&1
- %endif
- # Stop all daemons other than zebra and watchfrr.
- for daemon in %all_daemons ; do
- if [ x"${daemon}" != x"" ] ; then
- eval restart=\$restart_${daemon}
- [ "$restart" = yes ] && \
- /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
- fi
- done
- # Restart zebra.
- [ "$running_zebra" = yes ] && \
- /etc/rc.d/init.d/zebra restart >/dev/null 2>&1
- # Start all daemons other than zebra and watchfrr.
- for daemon in %all_daemons ; do
- if [ x"${daemon}" != x"" ] ; then
- eval restart=\$restart_${daemon}
- [ "$restart" = yes ] && \
- /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1
- fi
- done
- %if %{with_watchfrr}
- # Start watchfrr last.
- # Avoid postun scriptlet error if watchfrr is not running.
- [ "$running_watchfrr" = yes ] && \
- /etc/rc.d/init.d/watchfrr start >/dev/null 2>&1 || :
- %endif
+ /etc/rc.d/init.d/frr restart >/dev/null 2>&1
%endif
+ :
fi
%preun
if [ "$1" = "0" ]; then
for daemon in %all_daemons ; do
if [ x"${daemon}" != x"" ] ; then
- %systemd_preun ${daemon}.service
+ %systemd_preun frr.service
fi
done
fi
%attr(755,root,root) %{_libdir}/lib*.so.0.*
%endif
%{_bindir}/*
-%config(noreplace) /etc/frr/[!v]*
-%attr(750,%frr_user,%frr_user) /etc/frr/daemons
+%config(noreplace) /etc/frr/[!v]*.conf*
+%config(noreplace) %attr(750,%frr_user,%frr_user) /etc/frr/daemons
%if "%{initsystem}" == "systemd"
- %config %{_unitdir}/frr.service
+ %attr(644,root,root) %{_unitdir}/frr.service
%{_sbindir}/frr
%else
- %config /etc/rc.d/init.d/frr
+ /etc/rc.d/init.d/frr
+ %{_sbindir}/frr
%endif
%config(noreplace) /etc/pam.d/frr
%config(noreplace) %attr(640,root,root) /etc/logrotate.d/*
%endif
%changelog
-* Thu Apr 17 2017 Martin Winter <mwinter@opensourcerouting.org> - %{version}
+* Fri Oct 20 2017 Martin Winter <mwinter@opensourcerouting.org> - %{version}
+- Fix script location for watchfrr restart functions in daemon config
+
+* Mon Apr 17 2017 Martin Winter <mwinter@opensourcerouting.org>
- new subpackage frr-pythontools with python 2.7 restart script
- remove PIMd from CentOS/RedHat 6 RPM packages (won't work - too old)
- converted to single frr init script (not per daemon) based on debian init script