From 9f892cc56c7e74cb321eed10130a69056133074b Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:03:37 +0200 Subject: [PATCH 01/27] redhat: remove enable-poll option from specfile It was removed from configure.ac in 16764760 Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 064b78b26..61acb17e9 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -318,9 +318,10 @@ developing OSPF-API and frr applications. --enable-systemd \ %endif %if %{with_rpki} - --enable-rpki \ + --enable-rpki +%else + --disable-rpki %endif - --enable-poll make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" SPHINXBUILD=%{sphinx} From 931e1d6824778afc31e3ddc09816054bdafa4260 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:08:28 +0200 Subject: [PATCH 02/27] redhat: stop overriding _sysconfdir This macro is defined by rpm and points at /etc. Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 61acb17e9..97bbcb40a 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -30,7 +30,7 @@ %{!?with_pbrd: %global with_pbrd 1 } # path defines -%define _sysconfdir /etc/frr +%define configdir %{_sysconfdir}/%{name} %define _sbindir /usr/lib/frr %define zeb_src %{_builddir}/%{name}-%{frrversion} %define zeb_rh_src %{zeb_src}/redhat @@ -230,7 +230,7 @@ developing OSPF-API and frr applications. %configure \ --sbindir=%{_sbindir} \ - --sysconfdir=%{_sysconfdir} \ + --sysconfdir=%{configdir} \ --libdir=%{_libdir} \ --libexecdir=%{_libexecdir} \ --localstatedir=%{_localstatedir} \ @@ -442,49 +442,49 @@ done # 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 +%__sed -i 's|/etc/init.d/|%{_sbindir}/|g' %{configdir}/daemons 2> /dev/null || true # With systemd, watchfrr is mandatory. Fix config to make sure it's enabled if # we install or upgrade to a frr built with systemd %if "%{initsystem}" == "systemd" - %__sed -i 's|watchfrr_enable=no|watchfrr_enable=yes|g' %{_sysconfdir}/daemons 2> /dev/null || true + %__sed -i 's|watchfrr_enable=no|watchfrr_enable=yes|g' %{configdir}/daemons 2> /dev/null || true %endif /sbin/install-info %{_infodir}/frr.info.gz %{_infodir}/dir # Create dummy files if they don't exist so basic functions can be used. -if [ ! -e %{_sysconfdir}/zebra.conf ]; then - echo "hostname `hostname`" > %{_sysconfdir}/zebra.conf +if [ ! -e %{configdir}/zebra.conf ]; then + echo "hostname `hostname`" > %{configdir}/zebra.conf %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{_sysconfdir}/zebra.conf* + chown %frr_user:%frr_user %{configdir}/zebra.conf* %endif - chmod 640 %{_sysconfdir}/zebra.conf* + chmod 640 %{configdir}/zebra.conf* fi for daemon in %{all_daemons} ; do if [ x"${daemon}" != x"" ] ; then - if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then - touch %{_sysconfdir}/${daemon}.conf + if [ ! -e %{configdir}/${daemon}.conf ]; then + touch %{configdir}/${daemon}.conf %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{_sysconfdir}/${daemon}.conf* + chown %frr_user:%frr_user %{configdir}/${daemon}.conf* %endif fi fi done %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{_sysconfdir}/daemons + chown %frr_user:%frr_user %{configdir}/daemons %endif %if %{with_watchfrr} # No config for watchfrr - this is part of /etc/sysconfig/frr - rm -f %{_sysconfdir}/watchfrr.* + rm -f %{configdir}/watchfrr.* %endif -if [ ! -e %{_sysconfdir}/vtysh.conf ]; then - touch %{_sysconfdir}/vtysh.conf - chmod 640 %{_sysconfdir}/vtysh.conf +if [ ! -e %{configdir}/vtysh.conf ]; then + touch %{configdir}/vtysh.conf + chmod 640 %{configdir}/vtysh.conf %if 0%{?frr_user:1} %if 0%{?vty_group:1} - chown %{frr_user}:%{vty_group} %{_sysconfdir}/vtysh.conf* + chown %{frr_user}:%{vty_group} %{configdir}/vtysh.conf* %endif %endif fi @@ -538,16 +538,16 @@ rm -rf %{buildroot} %doc doc/mpls %doc ChangeLog NEWS README %if 0%{?frr_user:1} -%dir %attr(751,%frr_user,%frr_user) %{_sysconfdir} +%dir %attr(751,%frr_user,%frr_user) %{configdir} %dir %attr(750,%frr_user,%frr_user) /var/log/frr %dir %attr(751,%frr_user,%frr_user) /var/run/frr %else -%dir %attr(750,root,root) %{_sysconfdir} +%dir %attr(750,root,root) %{configdir} %dir %attr(750,root,root) /var/log/frr %dir %attr(750,root,root) /var/run/frr %endif %if 0%{?vty_group:1} -%attr(750,%frr_user,%vty_group) %{_sysconfdir}/vtysh.conf.sample +%attr(750,%frr_user,%vty_group) %{configdir}/vtysh.conf.sample %endif %{_infodir}/frr.info.gz %{_mandir}/man*/* From e9956ac7e0f163d6e60ca7c15b49254706e88d08 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:14:37 +0200 Subject: [PATCH 03/27] redhat: remove some defaults from configure options Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 97bbcb40a..fb59f9af9 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -231,8 +231,6 @@ developing OSPF-API and frr applications. %configure \ --sbindir=%{_sbindir} \ --sysconfdir=%{configdir} \ - --libdir=%{_libdir} \ - --libexecdir=%{_libexecdir} \ --localstatedir=%{_localstatedir} \ --disable-werror \ --enable-irdp \ From 0bb68611403decc9918104f7399202d44fb3d6d3 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:19:11 +0200 Subject: [PATCH 04/27] redhat: stop overriding _localstatedir It is defined by rpm and points at /var Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index fb59f9af9..c32680fbd 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -38,7 +38,7 @@ %define frr_tools %{zeb_src}/tools # defines for configure -%define _localstatedir /var/run/frr +%define rundir %{_localstatedir}/run/%{name} # define for sphinx-build binary %if 0%{?rhel} && 0%{?rhel} < 7 @@ -231,7 +231,7 @@ developing OSPF-API and frr applications. %configure \ --sbindir=%{_sbindir} \ --sysconfdir=%{configdir} \ - --localstatedir=%{_localstatedir} \ + --localstatedir=%{rundir} \ --disable-werror \ --enable-irdp \ %if !%{with_shared} @@ -379,7 +379,7 @@ fi if getent passwd %frr_user >/dev/null ; then : ; else \ /usr/sbin/useradd -u %frr_uid -g %frr_gid \ -M -r -s /sbin/nologin -c "FRRouting suite" \ - -d %_localstatedir %frr_user 2> /dev/null || : ; \ + -d %{rundir} %frr_user 2> /dev/null || : ; \ fi %if 0%{?vty_group:1} /usr/sbin/usermod -a -G %vty_group %frr_user From 9b9796466b1e8a3d02f997354202cad2343286f4 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:29:39 +0200 Subject: [PATCH 05/27] redhat: replace /etc/ with _sysconfdir where we can Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index c32680fbd..8fc0c0c27 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -328,7 +328,7 @@ make SPHINXBUILD=%{sphinx} info popd %install -mkdir -p %{buildroot}/etc/{frr,sysconfig,logrotate.d,pam.d,default} \ +mkdir -p %{buildroot}%{_sysconfdir}/{frr,sysconfig,logrotate.d,pam.d,default} \ %{buildroot}/var/log/frr %{buildroot}%{_infodir} make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" SPHINXBUILD=%{sphinx} install @@ -349,18 +349,18 @@ install -m644 %{zeb_rh_src}/frr.service \ install %{zeb_rh_src}/frr.init \ %{buildroot}%{_sbindir}/frr %else -mkdir -p %{buildroot}/etc/rc.d/init.d +mkdir -p %{buildroot}%{_initddir} install %{zeb_rh_src}/frr.init \ %{buildroot}%{_sbindir}/frr ln -s %{_sbindir}/frr \ - %{buildroot}/etc/rc.d/init.d/frr + %{buildroot}%{_initddir}/frr %endif -install %{zeb_rh_src}/daemons %{buildroot}/etc/frr +install %{zeb_rh_src}/daemons %{buildroot}%{_sysconfdir}/frr install -m644 %{zeb_rh_src}/frr.pam \ - %{buildroot}/etc/pam.d/frr + %{buildroot}%{_sysconfdir}/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate \ - %{buildroot}/etc/logrotate.d/frr + %{buildroot}%{_sysconfdir}/logrotate.d/frr install -d -m750 %{buildroot}/var/run/frr %pre @@ -394,9 +394,9 @@ fi zebra_spec_add_service () { # Add port /etc/services entry if it isn't already there - if [ -f /etc/services ] && \ - ! %__sed -e 's/#.*$//' /etc/services | %__grep -wq $1 ; then - echo "$1 $2 # $3" >> /etc/services + if [ -f %{_sysconfdir}/services ] && \ + ! %__sed -e 's/#.*$//' %{_sysconfdir}/services | %__grep -wq $1 ; then + echo "$1 $2 # $3" >> %{_sysconfdir}/services fi } @@ -591,16 +591,16 @@ rm -rf %{buildroot} %endif %attr(755,root,root) %{_libdir}/frr/modules/zebra_irdp.so %{_bindir}/* -%config(noreplace) /etc/frr/[!v]*.conf* -%config(noreplace) %attr(750,%frr_user,%frr_user) /etc/frr/daemons +%config(noreplace) %{configdir}/[!v]*.conf* +%config(noreplace) %attr(750,%frr_user,%frr_user) %{configdir}/daemons %if "%{initsystem}" == "systemd" %{_unitdir}/frr.service %else - /etc/rc.d/init.d/frr + %{_initddir}/frr %endif %{_sbindir}/frr -%config(noreplace) /etc/pam.d/frr -%config(noreplace) /etc/logrotate.d/frr +%config(noreplace) %{_sysconfdir}/pam.d/frr +%config(noreplace) %{_sysconfdir}/logrotate.d/frr %{_sbindir}/frr-reload %files contrib From 515a8ee8f55bbdd1b7b625e3e97abea43ff662a3 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:32:26 +0200 Subject: [PATCH 06/27] redhat: use 'service' command to restart frr Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 8fc0c0c27..378e5fd96 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -501,7 +501,7 @@ if [ "$1" -ge 1 ]; then ## ## init.d Version ## - /etc/rc.d/init.d/frr restart >/dev/null 2>&1 + service frr restart >/dev/null 2>&1 %endif : fi @@ -519,7 +519,7 @@ fi ## init.d Version ## if [ $1 -eq 0 ] ; then - /etc/rc.d/init.d/frr stop >/dev/null 2>&1 + service frr stop >/dev/null 2>&1 /sbin/chkconfig --del frr fi %endif From 98a2aecb7ba26b5965d9f4f17dfe53fe886f0c35 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 14:49:08 +0200 Subject: [PATCH 07/27] redhat: replace hardcoded directory Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 378e5fd96..d1900a8d6 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -361,7 +361,7 @@ install -m644 %{zeb_rh_src}/frr.pam \ %{buildroot}%{_sysconfdir}/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate \ %{buildroot}%{_sysconfdir}/logrotate.d/frr -install -d -m750 %{buildroot}/var/run/frr +install -d -m750 %{buildroot}%{rundir} %pre # add vty_group @@ -538,11 +538,11 @@ rm -rf %{buildroot} %if 0%{?frr_user:1} %dir %attr(751,%frr_user,%frr_user) %{configdir} %dir %attr(750,%frr_user,%frr_user) /var/log/frr -%dir %attr(751,%frr_user,%frr_user) /var/run/frr +%dir %attr(751,%frr_user,%frr_user) %{rundir} %else %dir %attr(750,root,root) %{configdir} %dir %attr(750,root,root) /var/log/frr -%dir %attr(750,root,root) /var/run/frr +%dir %attr(750,root,root) %{rundir} %endif %if 0%{?vty_group:1} %attr(750,%frr_user,%vty_group) %{configdir}/vtysh.conf.sample From 5f371d0bdfdd3b19fce6d7b20b1929dc3034a950 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:23:27 +0200 Subject: [PATCH 08/27] redhat: indent some stuff in spec file Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 132 ++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 69 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index d1900a8d6..46e76962f 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -83,48 +83,48 @@ %{!?frr_gid: %global frr_gid 92 } %{!?vty_gid: %global vty_gid 85 } -%define daemon_list zebra ripd ospfd bgpd isisd ripngd ospf6d pbrd +%define daemon_list zebra ripd ospfd bgpd isisd ripngd ospf6d pbrd %if %{with_ldpd} -%define daemon_ldpd ldpd + %define daemon_ldpd ldpd %else -%define daemon_ldpd "" + %define daemon_ldpd "" %endif %if %{with_pimd} -%define daemon_pimd pimd + %define daemon_pimd pimd %else -%define daemon_pimd "" + %define daemon_pimd "" %endif %if %{with_pbrd} -%define daemon_pbrd pbrd + %define daemon_pbrd pbrd %else -%define daemon_pbrd "" + %define daemon_pbrd "" %endif %if %{with_nhrpd} -%define daemon_nhrpd nhrpd + %define daemon_nhrpd nhrpd %else -%define daemon_nhrpd "" + %define daemon_nhrpd "" %endif %if %{with_eigrpd} -%define daemon_eigrpd eigrpd + %define daemon_eigrpd eigrpd %else -%define daemon_eigrpd "" + %define daemon_eigrpd "" %endif %if %{with_babeld} -%define daemon_babeld babeld + %define daemon_babeld babeld %else -%define daemon_babeld "" + %define daemon_babeld "" %endif %if %{with_watchfrr} -%define daemon_watchfrr watchfrr + %define daemon_watchfrr watchfrr %else -%define daemon_watchfrr "" + %define daemon_watchfrr "" %endif %define all_daemons %{daemon_list} %{daemon_ldpd} %{daemon_pimd} %{daemon_nhrpd} %{daemon_eigrpd} %{daemon_babeld} %{daemon_watchfrr} %{daemon_pbrd} @@ -214,7 +214,7 @@ The frr-devel package contains the header and object files neccessary for developing OSPF-API and frr applications. %prep -%setup -q -n frr-%{frrversion} +%setup -q -n frr-%{frrversion} %build @@ -344,45 +344,39 @@ rm -f %{buildroot}%{_libdir}/frr/modules/*.la # install /etc sources %if "%{initsystem}" == "systemd" mkdir -p %{buildroot}%{_unitdir} -install -m644 %{zeb_rh_src}/frr.service \ - %{buildroot}%{_unitdir}/frr.service -install %{zeb_rh_src}/frr.init \ - %{buildroot}%{_sbindir}/frr +install -m644 %{zeb_rh_src}/frr.service %{buildroot}%{_unitdir}/frr.service +install %{zeb_rh_src}/frr.init %{buildroot}%{_sbindir}/frr %else mkdir -p %{buildroot}%{_initddir} -install %{zeb_rh_src}/frr.init \ - %{buildroot}%{_sbindir}/frr -ln -s %{_sbindir}/frr \ - %{buildroot}%{_initddir}/frr +install %{zeb_rh_src}/frr.init %{buildroot}%{_sbindir}/frr +ln -s %{_sbindir}/frr %{buildroot}%{_initddir}/frr %endif install %{zeb_rh_src}/daemons %{buildroot}%{_sysconfdir}/frr -install -m644 %{zeb_rh_src}/frr.pam \ - %{buildroot}%{_sysconfdir}/pam.d/frr -install -m644 %{zeb_rh_src}/frr.logrotate \ - %{buildroot}%{_sysconfdir}/logrotate.d/frr -install -d -m750 %{buildroot}%{rundir} +install -m644 %{zeb_rh_src}/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr +install -m644 %{zeb_rh_src}/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr +install -d -m750 %{buildroot}%{rundir} %pre # add vty_group %if 0%{?vty_group:1} if getent group %vty_group > /dev/null ; then : ; else \ - /usr/sbin/groupadd -r -g %vty_gid %vty_group > /dev/null || : ; fi + /usr/sbin/groupadd -r -g %vty_gid %vty_group > /dev/null || : ; fi %endif # add frr user and group %if 0%{?frr_user:1} # Ensure that frr_gid gets correctly allocated if getent group %frr_user >/dev/null; then : ; else \ - /usr/sbin/groupadd -g %frr_gid %frr_user > /dev/null || : ; \ + /usr/sbin/groupadd -g %frr_gid %frr_user > /dev/null || : ; \ fi if getent passwd %frr_user >/dev/null ; then : ; else \ - /usr/sbin/useradd -u %frr_uid -g %frr_gid \ - -M -r -s /sbin/nologin -c "FRRouting suite" \ - -d %{rundir} %frr_user 2> /dev/null || : ; \ + /usr/sbin/useradd -u %frr_uid -g %frr_gid \ + -M -r -s /sbin/nologin -c "FRRouting suite" \ + -d %{rundir} %frr_user 2> /dev/null || : ; \ fi %if 0%{?vty_group:1} -/usr/sbin/usermod -a -G %vty_group %frr_user + /usr/sbin/usermod -a -G %vty_group %frr_user %endif %endif @@ -407,35 +401,35 @@ zebra_spec_add_service ripngd 2603/tcp "RIPngd vty" zebra_spec_add_service ospfd 2604/tcp "OSPFd vty" zebra_spec_add_service bgpd 2605/tcp "BGPd vty" zebra_spec_add_service ospf6d 2606/tcp "OSPF6d vty" -%if %{with_ospfapi} -zebra_spec_add_service ospfapi 2607/tcp "OSPF-API" -%endif zebra_spec_add_service isisd 2608/tcp "ISISd vty" +%if %{with_ospfapi} + zebra_spec_add_service ospfapi 2607/tcp "OSPF-API" +%endif %if %{with_babeld} -zebra_spec_add_service babeld 2609/tcp "BABELd vty" + zebra_spec_add_service babeld 2609/tcp "BABELd vty" %endif %if %{with_nhrpd} -zebra_spec_add_service nhrpd 2610/tcp "NHRPd vty" + zebra_spec_add_service nhrpd 2610/tcp "NHRPd vty" %endif %if %{with_pimd} -zebra_spec_add_service pimd 2611/tcp "PIMd vty" + zebra_spec_add_service pimd 2611/tcp "PIMd vty" %endif %if %{with_pbrd} -zebra_spec_add_service pbrd 2615/tcp "PBRd vty" + zebra_spec_add_service pbrd 2615/tcp "PBRd vty" %endif %if %{with_ldpd} -zebra_spec_add_service ldpd 2612/tcp "LDPd vty" + zebra_spec_add_service ldpd 2612/tcp "LDPd vty" %endif %if %{with_eigrpd} -zebra_spec_add_service eigrpd 2613/tcp "EIGRPd vty" + zebra_spec_add_service eigrpd 2613/tcp "EIGRPd vty" %endif %if "%{initsystem}" == "systemd" -for daemon in %all_daemons ; do - %systemd_post frr.service -done + for daemon in %all_daemons ; do + %systemd_post frr.service + done %else -/sbin/chkconfig --add frr + /sbin/chkconfig --add frr %endif # Fix bad path in previous config files @@ -481,9 +475,9 @@ if [ ! -e %{configdir}/vtysh.conf ]; then touch %{configdir}/vtysh.conf chmod 640 %{configdir}/vtysh.conf %if 0%{?frr_user:1} -%if 0%{?vty_group:1} - chown %{frr_user}:%{vty_group} %{configdir}/vtysh.conf* -%endif + %if 0%{?vty_group:1} + chown %{frr_user}:%{vty_group} %{configdir}/vtysh.conf* + %endif %endif fi @@ -527,7 +521,7 @@ fi %clean %if !0%{?keep_build:1} -rm -rf %{buildroot} + rm -rf %{buildroot} %endif %files @@ -536,16 +530,16 @@ rm -rf %{buildroot} %doc doc/mpls %doc ChangeLog NEWS README %if 0%{?frr_user:1} -%dir %attr(751,%frr_user,%frr_user) %{configdir} -%dir %attr(750,%frr_user,%frr_user) /var/log/frr -%dir %attr(751,%frr_user,%frr_user) %{rundir} + %dir %attr(751,%frr_user,%frr_user) %{configdir} + %dir %attr(750,%frr_user,%frr_user) /var/log/frr + %dir %attr(751,%frr_user,%frr_user) %{rundir} %else -%dir %attr(750,root,root) %{configdir} -%dir %attr(750,root,root) /var/log/frr -%dir %attr(750,root,root) %{rundir} + %dir %attr(750,root,root) %{configdir} + %dir %attr(750,root,root) /var/log/frr + %dir %attr(750,root,root) %{rundir} %endif %if 0%{?vty_group:1} -%attr(750,%frr_user,%vty_group) %{configdir}/vtysh.conf.sample + %attr(750,%frr_user,%vty_group) %{configdir}/vtysh.conf.sample %endif %{_infodir}/frr.info.gz %{_mandir}/man*/* @@ -579,15 +573,15 @@ rm -rf %{buildroot} %{_sbindir}/babeld %endif %if %{with_shared} -%{_libdir}/lib*.so -%{_libdir}/lib*.so.0 -%attr(755,root,root) %{_libdir}/lib*.so.0.* + %{_libdir}/lib*.so + %{_libdir}/lib*.so.0 + %attr(755,root,root) %{_libdir}/lib*.so.0.* %endif %if %{with_fpm} -%attr(755,root,root) %{_libdir}/frr/modules/zebra_fpm.so + %attr(755,root,root) %{_libdir}/frr/modules/zebra_fpm.so %endif %if %{with_rpki} -%attr(755,root,root) %{_libdir}/frr/modules/bgpd_rpki.so + %attr(755,root,root) %{_libdir}/frr/modules/bgpd_rpki.so %endif %attr(755,root,root) %{_libdir}/frr/modules/zebra_irdp.so %{_bindir}/* @@ -616,7 +610,7 @@ rm -rf %{buildroot} %files devel %defattr(-,root,root) %if %{with_ospfclient} -%{_sbindir}/ospfclient + %{_sbindir}/ospfclient %endif %{_libdir}/*.a %{_libdir}/*.la @@ -625,12 +619,12 @@ rm -rf %{buildroot} %dir %attr(755,root,root) %{_includedir}/%{name}/ospfd %{_includedir}/%name/ospfd/*.h %if %{with_ospfapi} -%dir %attr(755,root,root) %{_includedir}/%{name}/ospfapi -%{_includedir}/%name/ospfapi/*.h + %dir %attr(755,root,root) %{_includedir}/%{name}/ospfapi + %{_includedir}/%name/ospfapi/*.h %endif %if %{with_eigrpd} -%dir %attr(755,root,root) %{_includedir}/%{name}/eigrpd -%{_includedir}/%name/eigrpd/*.h + %dir %attr(755,root,root) %{_includedir}/%{name}/eigrpd + %{_includedir}/%name/eigrpd/*.h %endif %changelog From 772d418a8bd7fc40aaaa47eca8152cda44f7b001 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:25:42 +0200 Subject: [PATCH 09/27] redhat: remove superfluous Requires for json-c json-c-devel is already a BuildRequires, and rpm will add the Requires itself. Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 46e76962f..9aa46bbbc 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -155,7 +155,7 @@ BuildRequires: python27-devel python27-sphinx %else BuildRequires: python-devel >= 2.7 python-sphinx %endif -Requires: json-c initscripts +Requires: initscripts %if %{with_pam} BuildRequires: pam-devel %endif From ec59a1559cce612d04131639653eddf65d69e868 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:27:10 +0200 Subject: [PATCH 10/27] redhat: don't Requires initscript on systemd based distros Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 9aa46bbbc..92fca3d35 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -155,7 +155,6 @@ BuildRequires: python27-devel python27-sphinx %else BuildRequires: python-devel >= 2.7 python-sphinx %endif -Requires: initscripts %if %{with_pam} BuildRequires: pam-devel %endif @@ -172,6 +171,7 @@ Requires(post): chkconfig Requires(preun): chkconfig # Initscripts > 5.60 is required for IPv6 support Requires(pre): initscripts >= 5.60 +Requires: initscripts %endif Provides: routingdaemon = %{version}-%{release} BuildRoot: %{_tmppath}/%{name}-%{version}-root From 7eec5b4c38ac1d23be3c60970159b55b9e606277 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:29:16 +0200 Subject: [PATCH 11/27] redhat: remove BuildRequires for patch Nothing seems to need it Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 92fca3d35..6f4123413 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -145,7 +145,7 @@ Source0: https://github.com/FRRouting/frr/archive/%{name}-%{frrversion}.t URL: https://www.frrouting.org Requires(preun): info Requires(post): info -BuildRequires: gcc patch libcap-devel +BuildRequires: gcc libcap-devel BuildRequires: readline-devel ncurses-devel BuildRequires: json-c-devel bison >= 2.7 flex make BuildRequires: c-ares-devel texinfo From 5ebf96721a6bc92d36ca5e58d3aac3307eb42910 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:33:01 +0200 Subject: [PATCH 12/27] redhat: use one BuildRequires per line Makes for easier diffing Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 6f4123413..a2ec59a58 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -145,15 +145,23 @@ Source0: https://github.com/FRRouting/frr/archive/%{name}-%{frrversion}.t URL: https://www.frrouting.org Requires(preun): info Requires(post): info -BuildRequires: gcc libcap-devel -BuildRequires: readline-devel ncurses-devel -BuildRequires: json-c-devel bison >= 2.7 flex make -BuildRequires: c-ares-devel texinfo +BuildRequires: bison >= 2.7 +BuildRequires: c-ares-devel +BuildRequires: flex +BuildRequires: gcc +BuildRequires: json-c-devel +BuildRequires: libcap-devel +BuildRequires: make +BuildRequires: ncurses-devel +BuildRequires: readline-devel +BuildRequires: texinfo %if 0%{?rhel} && 0%{?rhel} < 7 #python27-devel is available from ius community repo for RedHat/CentOS 6 -BuildRequires: python27-devel python27-sphinx +BuildRequires: python27-devel +BuildRequires: python27-sphinx %else -BuildRequires: python-devel >= 2.7 python-sphinx +BuildRequires: python-devel >= 2.7 +BuildRequires: python-sphinx %endif %if %{with_pam} BuildRequires: pam-devel @@ -162,7 +170,8 @@ BuildRequires: pam-devel BuildRequires: librtr-devel >= 0.5 %endif %if "%{initsystem}" == "systemd" -BuildRequires: systemd systemd-devel +BuildRequires: systemd +BuildRequires: systemd-devel Requires(post): systemd Requires(preun): systemd Requires(postun): systemd From e0c875f1b23f57ce711712fac087a2224bb1d4aa Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:33:48 +0200 Subject: [PATCH 13/27] redhat: remove obsolete BuildRoot tag Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 1 - 1 file changed, 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a2ec59a58..2fab981c6 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -183,7 +183,6 @@ Requires(pre): initscripts >= 5.60 Requires: initscripts %endif Provides: routingdaemon = %{version}-%{release} -BuildRoot: %{_tmppath}/%{name}-%{version}-root Obsoletes: gated mrt zebra frr-sysvinit Conflicts: bird From 35a1688ab96bcd2310710dee192588fe077fdeae Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:34:39 +0200 Subject: [PATCH 14/27] redhat: remove obsolete %clean section Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 8 -------- 1 file changed, 8 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 2fab981c6..d000664db 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -129,9 +129,6 @@ %define all_daemons %{daemon_list} %{daemon_ldpd} %{daemon_pimd} %{daemon_nhrpd} %{daemon_eigrpd} %{daemon_babeld} %{daemon_watchfrr} %{daemon_pbrd} -# allow build dir to be kept -%{!?keep_build: %global keep_build 0 } - #release sub-revision (the two digits after the CONFDATE) %{!?release_rev: %global release_rev 01 } @@ -527,11 +524,6 @@ fi %endif /sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir -%clean -%if !0%{?keep_build:1} - rm -rf %{buildroot} -%endif - %files %defattr(-,root,root) %doc */*.sample* AUTHORS COPYING From 7bd661a2b5cdbae722db8c8544f228d28a8da32f Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:36:08 +0200 Subject: [PATCH 15/27] redhat: remove superflous defattr lines They are the default since RHEL5: https://pagure.io/packaging-committee/issue/77 Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 4 ---- 1 file changed, 4 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index d000664db..3cacb9e61 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -525,7 +525,6 @@ fi /sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir %files -%defattr(-,root,root) %doc */*.sample* AUTHORS COPYING %doc doc/mpls %doc ChangeLog NEWS README @@ -598,17 +597,14 @@ fi %{_sbindir}/frr-reload %files contrib -%defattr(-,root,root) %doc tools %files pythontools -%defattr(-,root,root) %{_sbindir}/frr-reload.py %{_sbindir}/frr-reload.pyc %{_sbindir}/frr-reload.pyo %files devel -%defattr(-,root,root) %if %{with_ospfclient} %{_sbindir}/ospfclient %endif From 5c3ad1d46a9fc3b715c361f4321a29b488684aee Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:39:02 +0200 Subject: [PATCH 16/27] redhat: remove support for static builds This just doesn't work as RHEL doesn't ship static libs for the dependencies. Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 3cacb9e61..a9c0bcd7b 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -18,7 +18,6 @@ %{!?with_nhrpd: %global with_nhrpd 1 } %{!?with_eigrpd: %global with_eigrpd 1 } %{!?with_babeld: %global with_babeld 1 } -%{!?with_shared: %global with_shared 1 } %{!?with_multipath: %global with_multipath 256 } %{!?frr_user: %global frr_user frr } %{!?vty_group: %global vty_group frrvty } @@ -237,11 +236,9 @@ developing OSPF-API and frr applications. --sbindir=%{_sbindir} \ --sysconfdir=%{configdir} \ --localstatedir=%{rundir} \ + --disable-static \ --disable-werror \ --enable-irdp \ -%if !%{with_shared} - --disable-shared \ -%endif %if %{with_multipath} --enable-multipath=%{with_multipath} \ %endif @@ -343,8 +340,9 @@ rm -rf %{buildroot}/usr/share/info/dir # Remove debian init script if it was installed rm -f %{buildroot}%{_sbindir}/frr -# kill bogus libtool files for modules -rm -f %{buildroot}%{_libdir}/frr/modules/*.la +# kill bogus libtool files +rm -vf %{buildroot}%{_libdir}/frr/modules/*.la +rm -vf %{buildroot}%{_libdir}/*.la # install /etc sources %if "%{initsystem}" == "systemd" @@ -571,11 +569,9 @@ fi %if %{with_babeld} %{_sbindir}/babeld %endif -%if %{with_shared} - %{_libdir}/lib*.so - %{_libdir}/lib*.so.0 - %attr(755,root,root) %{_libdir}/lib*.so.0.* -%endif +%{_libdir}/lib*.so +%{_libdir}/lib*.so.0 +%attr(755,root,root) %{_libdir}/lib*.so.0.* %if %{with_fpm} %attr(755,root,root) %{_libdir}/frr/modules/zebra_fpm.so %endif @@ -608,8 +604,6 @@ fi %if %{with_ospfclient} %{_sbindir}/ospfclient %endif -%{_libdir}/*.a -%{_libdir}/*.la %dir %attr(755,root,root) %{_includedir}/%{name} %{_includedir}/%name/*.h %dir %attr(755,root,root) %{_includedir}/%{name}/ospfd From d1ef2aafc8c6ebeead96e2cfa593429d6de4aa35 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:40:45 +0200 Subject: [PATCH 17/27] redhat: unversioned libs belong in -devel package Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a9c0bcd7b..e90709903 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -569,7 +569,6 @@ fi %if %{with_babeld} %{_sbindir}/babeld %endif -%{_libdir}/lib*.so %{_libdir}/lib*.so.0 %attr(755,root,root) %{_libdir}/lib*.so.0.* %if %{with_fpm} @@ -601,6 +600,7 @@ fi %{_sbindir}/frr-reload.pyo %files devel +%{_libdir}/lib*.so %if %{with_ospfclient} %{_sbindir}/ospfclient %endif From 1dc5a0dc3c77ab421092fb8b2b55529b978d85ef Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:45:24 +0200 Subject: [PATCH 18/27] redhat: quote a few macros Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index e90709903..754a925c0 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -292,11 +292,11 @@ developing OSPF-API and frr applications. --with-libpam \ %endif %if 0%{?frr_user:1} - --enable-user=%frr_user \ - --enable-group=%frr_user \ + --enable-user=%{frr_user} \ + --enable-group=%{frr_user} \ %endif %if 0%{?vty_group:1} - --enable-vty-group=%vty_group \ + --enable-vty-group=%{vty_group} \ %endif %if %{with_fpm} --enable-fpm \ @@ -363,23 +363,23 @@ install -d -m750 %{buildroot}%{rundir} %pre # add vty_group %if 0%{?vty_group:1} -if getent group %vty_group > /dev/null ; then : ; else \ - /usr/sbin/groupadd -r -g %vty_gid %vty_group > /dev/null || : ; fi +if getent group %{vty_group} > /dev/null ; then : ; else \ + /usr/sbin/groupadd -r -g %vty_gid %{vty_group} > /dev/null || : ; fi %endif # add frr user and group %if 0%{?frr_user:1} # Ensure that frr_gid gets correctly allocated -if getent group %frr_user >/dev/null; then : ; else \ - /usr/sbin/groupadd -g %frr_gid %frr_user > /dev/null || : ; \ +if getent group %{frr_user} >/dev/null; then : ; else \ + /usr/sbin/groupadd -g %frr_gid %{frr_user} > /dev/null || : ; \ fi -if getent passwd %frr_user >/dev/null ; then : ; else \ +if getent passwd %{frr_user} >/dev/null ; then : ; else \ /usr/sbin/useradd -u %frr_uid -g %frr_gid \ -M -r -s /sbin/nologin -c "FRRouting suite" \ - -d %{rundir} %frr_user 2> /dev/null || : ; \ + -d %{rundir} %{frr_user} 2> /dev/null || : ; \ fi %if 0%{?vty_group:1} - /usr/sbin/usermod -a -G %vty_group %frr_user + /usr/sbin/usermod -a -G %{vty_group} %{frr_user} %endif %endif @@ -451,7 +451,7 @@ zebra_spec_add_service isisd 2608/tcp "ISISd vty" if [ ! -e %{configdir}/zebra.conf ]; then echo "hostname `hostname`" > %{configdir}/zebra.conf %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{configdir}/zebra.conf* + chown %{frr_user}:%{frr_user} %{configdir}/zebra.conf* %endif chmod 640 %{configdir}/zebra.conf* fi @@ -460,13 +460,13 @@ for daemon in %{all_daemons} ; do if [ ! -e %{configdir}/${daemon}.conf ]; then touch %{configdir}/${daemon}.conf %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{configdir}/${daemon}.conf* + chown %{frr_user}:%{frr_user} %{configdir}/${daemon}.conf* %endif fi fi done %if 0%{?frr_user:1} - chown %frr_user:%frr_user %{configdir}/daemons + chown %{frr_user}:%{frr_user} %{configdir}/daemons %endif %if %{with_watchfrr} @@ -527,16 +527,16 @@ fi %doc doc/mpls %doc ChangeLog NEWS README %if 0%{?frr_user:1} - %dir %attr(751,%frr_user,%frr_user) %{configdir} - %dir %attr(750,%frr_user,%frr_user) /var/log/frr - %dir %attr(751,%frr_user,%frr_user) %{rundir} + %dir %attr(751,%{frr_user},%{frr_user}) %{configdir} + %dir %attr(750,%{frr_user},%{frr_user}) /var/log/frr + %dir %attr(751,%{frr_user},%{frr_user}) %{rundir} %else %dir %attr(750,root,root) %{configdir} %dir %attr(750,root,root) /var/log/frr %dir %attr(750,root,root) %{rundir} %endif %if 0%{?vty_group:1} - %attr(750,%frr_user,%vty_group) %{configdir}/vtysh.conf.sample + %attr(750,%{frr_user},%{vty_group}) %{configdir}/vtysh.conf.sample %endif %{_infodir}/frr.info.gz %{_mandir}/man*/* @@ -580,7 +580,7 @@ fi %attr(755,root,root) %{_libdir}/frr/modules/zebra_irdp.so %{_bindir}/* %config(noreplace) %{configdir}/[!v]*.conf* -%config(noreplace) %attr(750,%frr_user,%frr_user) %{configdir}/daemons +%config(noreplace) %attr(750,%{frr_user},%{frr_user}) %{configdir}/daemons %if "%{initsystem}" == "systemd" %{_unitdir}/frr.service %else From ff00e18d2d9a15e2e59e93b6d6277b462e82ed55 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:49:45 +0200 Subject: [PATCH 19/27] redhat: sort options Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 754a925c0..278ed1814 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -10,31 +10,33 @@ #################### FRRouting (FRR) configure options ##################### # with-feature options -%{!?with_pam: %global with_pam 0 } -%{!?with_ospfclient: %global with_ospfclient 1 } -%{!?with_ospfapi: %global with_ospfapi 1 } -%{!?with_rtadv: %global with_rtadv 1 } -%{!?with_ldpd: %global with_ldpd 1 } -%{!?with_nhrpd: %global with_nhrpd 1 } -%{!?with_eigrpd: %global with_eigrpd 1 } %{!?with_babeld: %global with_babeld 1 } -%{!?with_multipath: %global with_multipath 256 } -%{!?frr_user: %global frr_user frr } -%{!?vty_group: %global vty_group frrvty } -%{!?with_fpm: %global with_fpm 1 } -%{!?with_watchfrr: %global with_watchfrr 1 } %{!?with_bgp_vnc: %global with_bgp_vnc 0 } +%{!?with_eigrpd: %global with_eigrpd 1 } +%{!?with_fpm: %global with_fpm 1 } +%{!?with_ldpd: %global with_ldpd 1 } +%{!?with_multipath: %global with_multipath 256 } +%{!?with_nhrpd: %global with_nhrpd 1 } +%{!?with_ospfapi: %global with_ospfapi 1 } +%{!?with_ospfclient: %global with_ospfclient 1 } +%{!?with_pam: %global with_pam 0 } +%{!?with_pbrd: %global with_pbrd 1 } %{!?with_pimd: %global with_pimd 1 } %{!?with_rpki: %global with_rpki 0 } -%{!?with_pbrd: %global with_pbrd 1 } +%{!?with_rtadv: %global with_rtadv 1 } +%{!?with_watchfrr: %global with_watchfrr 1 } + +# user and group +%{!?frr_user: %global frr_user frr } +%{!?vty_group: %global vty_group frrvty } # path defines -%define configdir %{_sysconfdir}/%{name} -%define _sbindir /usr/lib/frr -%define zeb_src %{_builddir}/%{name}-%{frrversion} -%define zeb_rh_src %{zeb_src}/redhat -%define zeb_docs %{zeb_src}/doc -%define frr_tools %{zeb_src}/tools +%define configdir %{_sysconfdir}/%{name} +%define _sbindir /usr/lib/frr +%define zeb_src %{_builddir}/%{name}-%{frrversion} +%define zeb_rh_src %{zeb_src}/redhat +%define zeb_docs %{zeb_src}/doc +%define frr_tools %{zeb_src}/tools # defines for configure %define rundir %{_localstatedir}/run/%{name} From 1eca28ffdc865531a7334a4af3b20aba9c3e3612 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:50:29 +0200 Subject: [PATCH 20/27] redhat: more indentation Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 278ed1814..79d0eecf6 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -43,9 +43,9 @@ # define for sphinx-build binary %if 0%{?rhel} && 0%{?rhel} < 7 -%define sphinx sphinx-build2.7 + %define sphinx sphinx-build2.7 %else -%define sphinx sphinx-build + %define sphinx sphinx-build %endif ############################################################################ From 95c16f4c206873888c1a03dd9e0ae7faee0b3632 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:53:35 +0200 Subject: [PATCH 21/27] redhat: add some newlines between sections Makes the spec slightly easier to read Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 79d0eecf6..7ec92aa48 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -184,6 +184,7 @@ Provides: routingdaemon = %{version}-%{release} Obsoletes: gated mrt zebra frr-sysvinit Conflicts: bird + %description FRRouting is a free software that manages TCP/IP based routing protocol. It takes multi-server and multi-thread approach to resolve @@ -194,6 +195,7 @@ NHRP, Babel, PBR and EIGRP. FRRouting is a fork of Quagga. + %package contrib Summary: contrib tools for frr Group: System Environment/Daemons @@ -201,6 +203,7 @@ Group: System Environment/Daemons %description contrib Contributed/3rd party tools which may be of use with frr. + %package pythontools Summary: python tools for frr BuildRequires: python @@ -210,6 +213,7 @@ Group: System Environment/Daemons %description pythontools Contributed python 2.7 tools which may be of use with frr. + %package devel Summary: Header and object files for frr development Group: System Environment/Daemons @@ -219,9 +223,11 @@ Requires: %{name} = %{version}-%{release} The frr-devel package contains the header and object files neccessary for developing OSPF-API and frr applications. + %prep %setup -q -n frr-%{frrversion} + %build # For standard gcc verbosity, uncomment these lines: @@ -331,6 +337,7 @@ pushd doc make SPHINXBUILD=%{sphinx} info popd + %install mkdir -p %{buildroot}%{_sysconfdir}/{frr,sysconfig,logrotate.d,pam.d,default} \ %{buildroot}/var/log/frr %{buildroot}%{_infodir} @@ -362,6 +369,7 @@ install -m644 %{zeb_rh_src}/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr install -m644 %{zeb_rh_src}/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr install -d -m750 %{buildroot}%{rundir} + %pre # add vty_group %if 0%{?vty_group:1} @@ -486,6 +494,7 @@ if [ ! -e %{configdir}/vtysh.conf ]; then %endif fi + %postun if [ "$1" -ge 1 ]; then # @@ -505,6 +514,7 @@ if [ "$1" -ge 1 ]; then : fi + %preun %if "%{initsystem}" == "systemd" ## @@ -524,6 +534,7 @@ fi %endif /sbin/install-info --delete %{_infodir}/frr.info.gz %{_infodir}/dir + %files %doc */*.sample* AUTHORS COPYING %doc doc/mpls @@ -593,14 +604,17 @@ fi %config(noreplace) %{_sysconfdir}/logrotate.d/frr %{_sbindir}/frr-reload + %files contrib %doc tools + %files pythontools %{_sbindir}/frr-reload.py %{_sbindir}/frr-reload.pyc %{_sbindir}/frr-reload.pyo + %files devel %{_libdir}/lib*.so %if %{with_ospfclient} @@ -619,6 +633,7 @@ fi %{_includedir}/%name/eigrpd/*.h %endif + %changelog * Sun May 20 2018 Martin Winter - %{version} - Fixed RPKI RPM build From bc1dc4fe04e07c49c1024d73981eab7ee510a53e Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 15:56:28 +0200 Subject: [PATCH 22/27] redhat: remove macro from changelog rpmlint warns about this: macro-in-%changelog %{version} Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 7ec92aa48..7ee8b3be1 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -635,7 +635,7 @@ fi %changelog -* Sun May 20 2018 Martin Winter - %{version} +* Sun May 20 2018 Martin Winter - Fixed RPKI RPM build * Sun Mar 4 2018 Martin Winter From 4aa7422e823df8779b778acb8debd545af716602 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 16:00:41 +0200 Subject: [PATCH 23/27] redhat: remove some superflous %attr calls These are the default Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 7ee8b3be1..85f7ed5f2 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -583,14 +583,14 @@ fi %{_sbindir}/babeld %endif %{_libdir}/lib*.so.0 -%attr(755,root,root) %{_libdir}/lib*.so.0.* +%{_libdir}/lib*.so.0.* %if %{with_fpm} - %attr(755,root,root) %{_libdir}/frr/modules/zebra_fpm.so + %{_libdir}/frr/modules/zebra_fpm.so %endif %if %{with_rpki} - %attr(755,root,root) %{_libdir}/frr/modules/bgpd_rpki.so + %{_libdir}/frr/modules/bgpd_rpki.so %endif -%attr(755,root,root) %{_libdir}/frr/modules/zebra_irdp.so +%{_libdir}/frr/modules/zebra_irdp.so %{_bindir}/* %config(noreplace) %{configdir}/[!v]*.conf* %config(noreplace) %attr(750,%{frr_user},%{frr_user}) %{configdir}/daemons @@ -620,16 +620,16 @@ fi %if %{with_ospfclient} %{_sbindir}/ospfclient %endif -%dir %attr(755,root,root) %{_includedir}/%{name} +%dir %{_includedir}/%{name} %{_includedir}/%name/*.h -%dir %attr(755,root,root) %{_includedir}/%{name}/ospfd +%dir %{_includedir}/%{name}/ospfd %{_includedir}/%name/ospfd/*.h %if %{with_ospfapi} - %dir %attr(755,root,root) %{_includedir}/%{name}/ospfapi + %dir %{_includedir}/%{name}/ospfapi %{_includedir}/%name/ospfapi/*.h %endif %if %{with_eigrpd} - %dir %attr(755,root,root) %{_includedir}/%{name}/eigrpd + %dir %{_includedir}/%{name}/eigrpd %{_includedir}/%name/eigrpd/*.h %endif From 4f20eab14cc9e44fcc93fa87156444606c665e33 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 16:02:32 +0200 Subject: [PATCH 24/27] redhat: replace hardcoded path with variable Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 85f7ed5f2..85695c4c7 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -340,7 +340,7 @@ popd %install mkdir -p %{buildroot}%{_sysconfdir}/{frr,sysconfig,logrotate.d,pam.d,default} \ - %{buildroot}/var/log/frr %{buildroot}%{_infodir} + %{buildroot}%{_localstatedir}/log/frr %{buildroot}%{_infodir} make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" SPHINXBUILD=%{sphinx} install # Remove this file, as it is uninstalled and causes errors when building on RH9 @@ -541,11 +541,11 @@ fi %doc ChangeLog NEWS README %if 0%{?frr_user:1} %dir %attr(751,%{frr_user},%{frr_user}) %{configdir} - %dir %attr(750,%{frr_user},%{frr_user}) /var/log/frr + %dir %attr(750,%{frr_user},%{frr_user}) %{_localstatedir}/log/frr %dir %attr(751,%{frr_user},%{frr_user}) %{rundir} %else %dir %attr(750,root,root) %{configdir} - %dir %attr(750,root,root) /var/log/frr + %dir %attr(750,root,root) %{_localstatedir}/log/frr %dir %attr(750,root,root) %{rundir} %endif %if 0%{?vty_group:1} From b8b18c064bb0e046d2c00f850028330e33c3c7e4 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 16:03:23 +0200 Subject: [PATCH 25/27] redhat: quote %name macro Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 85695c4c7..a87ef97b9 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -621,16 +621,16 @@ fi %{_sbindir}/ospfclient %endif %dir %{_includedir}/%{name} -%{_includedir}/%name/*.h +%{_includedir}/%{name}/*.h %dir %{_includedir}/%{name}/ospfd -%{_includedir}/%name/ospfd/*.h +%{_includedir}/%{name}/ospfd/*.h %if %{with_ospfapi} %dir %{_includedir}/%{name}/ospfapi - %{_includedir}/%name/ospfapi/*.h + %{_includedir}/%{name}/ospfapi/*.h %endif %if %{with_eigrpd} %dir %{_includedir}/%{name}/eigrpd - %{_includedir}/%name/eigrpd/*.h + %{_includedir}/%{name}/eigrpd/*.h %endif From 0e3daa4df66ed50a98e6a5bdf0561b0792e3fc62 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 16:08:36 +0200 Subject: [PATCH 26/27] redhat: add option to enable Cumulus extensions Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index a87ef97b9..068adbda8 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -12,6 +12,7 @@ # with-feature options %{!?with_babeld: %global with_babeld 1 } %{!?with_bgp_vnc: %global with_bgp_vnc 0 } +%{!?with_cumulus: %global with_cumulus 0 } %{!?with_eigrpd: %global with_eigrpd 1 } %{!?with_fpm: %global with_fpm 1 } %{!?with_ldpd: %global with_ldpd 1 } @@ -316,6 +317,9 @@ developing OSPF-API and frr applications. %else --disable-watchfrr \ %endif +%if %{with_cumulus} + --enable-cumulus \ +%endif %if %{with_bgp_vnc} --enable-bgp-vnc \ %else From 1a629db7a12b9c96558cf2c4ce088220d16c28d5 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 20 Jun 2018 16:20:42 +0200 Subject: [PATCH 27/27] redhat: cleanup %pre snippet a bit Based on https://fedoraproject.org/wiki/Packaging:UsersAndGroups Signed-off-by: Ruben Kerkhof --- redhat/frr.spec.in | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 068adbda8..e2be7050d 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -142,6 +142,7 @@ License: GPLv2+ Group: System Environment/Daemons Source0: https://github.com/FRRouting/frr/archive/%{name}-%{frrversion}.tar.gz URL: https://www.frrouting.org +Requires(pre): shadow-utils Requires(preun): info Requires(post): info BuildRequires: bison >= 2.7 @@ -377,25 +378,23 @@ install -d -m750 %{buildroot}%{rundir} %pre # add vty_group %if 0%{?vty_group:1} -if getent group %{vty_group} > /dev/null ; then : ; else \ - /usr/sbin/groupadd -r -g %vty_gid %{vty_group} > /dev/null || : ; fi + getent group %{vty_group} >/dev/null || groupadd -r -g %{vty_gid} %{vty_group} %endif # add frr user and group %if 0%{?frr_user:1} -# Ensure that frr_gid gets correctly allocated -if getent group %{frr_user} >/dev/null; then : ; else \ - /usr/sbin/groupadd -g %frr_gid %{frr_user} > /dev/null || : ; \ -fi -if getent passwd %{frr_user} >/dev/null ; then : ; else \ - /usr/sbin/useradd -u %frr_uid -g %frr_gid \ - -M -r -s /sbin/nologin -c "FRRouting suite" \ - -d %{rundir} %{frr_user} 2> /dev/null || : ; \ -fi -%if 0%{?vty_group:1} - /usr/sbin/usermod -a -G %{vty_group} %{frr_user} -%endif + # Ensure that frr_gid gets correctly allocated + getent group %{frr_user} >/dev/null || groupadd -g %{frr_gid} %{frr_user} + getent passwd %{frr_user} >/dev/null || \ + useradd -r -u %{frr_uid} -g %{frr_user} \ + -s /sbin/nologin -c "FRRouting suite" \ + -d %{rundir} %{frr_user} + + %if 0%{?vty_group:1} + usermod -a -G %{vty_group} %{frr_user} + %endif %endif +exit 0 %post