]> git.proxmox.com Git - mirror_frr.git/blobdiff - redhat/frr.spec.in
debianpkg, redhat, tools: Fixup startup/build for new daemon
[mirror_frr.git] / redhat / frr.spec.in
index 46e76962f32a776b2bbec20bcc316a4bf290923e..f5b116978e4e27660d81ba3a414996732169523a 100644 (file)
 
 #################### 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_shared:        %global  with_shared        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_cumulus:       %global  with_cumulus       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}
 
 # 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
 ############################################################################
 
@@ -83,7 +85,7 @@
 %{!?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 staticd
 
 %if %{with_ldpd}
     %define daemon_ldpd ldpd
 
 %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 }
 
@@ -143,19 +142,27 @@ 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:  gcc patch 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
-Requires:       json-c initscripts
 %if %{with_pam}
 BuildRequires:  pam-devel
 %endif
@@ -163,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
@@ -172,12 +180,13 @@ 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
 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
@@ -188,6 +197,7 @@ NHRP, Babel, PBR and EIGRP.
 
 FRRouting is a fork of Quagga.
 
+
 %package contrib
 Summary: contrib tools for frr
 Group: System Environment/Daemons
@@ -195,6 +205,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
@@ -204,6 +215,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
@@ -213,9 +225,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:
@@ -232,11 +246,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
@@ -290,11 +302,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 \
@@ -306,6 +318,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
@@ -327,9 +342,10 @@ 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}
+         %{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
@@ -338,8 +354,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"
@@ -353,32 +370,35 @@ ln -s %{_sbindir}/frr %{buildroot}%{_initddir}/frr
 %endif
 
 install %{zeb_rh_src}/daemons %{buildroot}%{_sysconfdir}/frr
+# add rpki module to daemon
+%if %{with_rpki}
+    sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{buildroot}%{_sysconfdir}/frr/daemons
+%endif
 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
+    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
@@ -396,6 +416,7 @@ zebra_spec_add_service ()
 
 zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
 zebra_spec_add_service zebra    2601/tcp "zebra vty"
+zebra_spec_add_service staticd  2616/tcp "staticd vty"
 zebra_spec_add_service ripd     2602/tcp "RIPd vty"
 zebra_spec_add_service ripngd   2603/tcp "RIPngd vty"
 zebra_spec_add_service ospfd    2604/tcp "OSPFd vty"
@@ -448,7 +469,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
@@ -457,13 +478,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}
@@ -481,6 +502,7 @@ if [ ! -e %{configdir}/vtysh.conf ]; then
 %endif
 fi
 
+
 %postun
 if [ "$1" -ge 1 ]; then
     #
@@ -500,6 +522,7 @@ if [ "$1" -ge 1 ]; then
     :
 fi
 
+
 %preun
 %if "%{initsystem}" == "systemd"
     ##
@@ -519,31 +542,27 @@ 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
 %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}) %{_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}
-    %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*/*
 %{_sbindir}/zebra
+%{_sbindir}/staticd
 %{_sbindir}/ospfd
 %{_sbindir}/ripd
 %{_sbindir}/bgpd
@@ -572,21 +591,18 @@ 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.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
+%config(noreplace) %attr(750,%{frr_user},%{frr_user}) %{configdir}/daemons
 %if "%{initsystem}" == "systemd"
     %{_unitdir}/frr.service
 %else
@@ -597,38 +613,38 @@ fi
 %config(noreplace) %{_sysconfdir}/logrotate.d/frr
 %{_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)
+%{_libdir}/lib*.so
 %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
-%{_includedir}/%name/ospfd/*.h
+%dir %{_includedir}/%{name}
+%{_includedir}/%{name}/*.h
+%dir %{_includedir}/%{name}/ospfd
+%{_includedir}/%{name}/ospfd/*.h
 %if %{with_ospfapi}
-    %dir %attr(755,root,root) %{_includedir}/%{name}/ospfapi
-    %{_includedir}/%name/ospfapi/*.h
+    %dir %{_includedir}/%{name}/ospfapi
+    %{_includedir}/%{name}/ospfapi/*.h
 %endif
 %if %{with_eigrpd}
-    %dir %attr(755,root,root) %{_includedir}/%{name}/eigrpd
-    %{_includedir}/%name/eigrpd/*.h
+    %dir %{_includedir}/%{name}/eigrpd
+    %{_includedir}/%{name}/eigrpd/*.h
 %endif
 
+
 %changelog
-* Sun May 20 2018 Martin Winter <mwinter@opensourcerouting.org> - %{version}
+* Sun May 20 2018 Martin Winter <mwinter@opensourcerouting.org>
 - Fixed RPKI RPM build
 
 * Sun Mar  4 2018 Martin Winter <mwinter@opensourcerouting.org>