]> git.proxmox.com Git - mirror_frr.git/blobdiff - redhat/frr.spec.in
redhat: stop overriding _localstatedir
[mirror_frr.git] / redhat / frr.spec.in
index 8632a4fb2f0f7fa6c3bd2a54a8095a5ac09579e3..c32680fbdfdc30532312cdc6d3edb0b77a751067 100644 (file)
@@ -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
@@ -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
 
 #### Check for systemd or init.d (upstart)
 # Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7)
-%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
+%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
     %global initsystem systemd
 %else
-%if (0%{?fedora} && 0%{?fedora} < 15) || (0%{?rhel} && 0%{?rhel} < 7)
+%if 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
-#
+
+# If init system is systemd, then always enable watchfrr
 %if "%{initsystem}" == "systemd"
-    # Note: For systems with systemd, watchfrr will NOT be built. Systemd
-    # takes over the role of restarting crashed processes. Value will
-    # be overwritten with 0 below for systemd independent on the setting here
     %global with_watchfrr 1
 %endif
 
-#### Check for RedHat 6.x or CentOS 6.x - they are too old to support PIM. 
+#### Check for RedHat 6.x or CentOS 6.x - they are too old to support PIM.
 ####   Always disable it on these old systems unconditionally
 #
 # if CentOS / RedHat and version < 7, then disable PIMd (too old, won't work)
 %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}
+%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 }
@@ -145,13 +141,12 @@ Version:        %{rpmversion}
 Release:        @CONFDATE@%{release_rev}%{?dist}
 License:        GPLv2+
 Group:          System Environment/Daemons
-Source0:        http://www.frrouting.org/releases/frr/%{name}-%{frrversion}.tar.gz
-URL:            http://www.frrouting.org
-Requires(pre):  /sbin/install-info
-Requires(preun): /sbin/install-info
-Requires(post): /sbin/install-info
+Source0:        https://github.com/FRRouting/frr/archive/%{name}-%{frrversion}.tar.gz
+URL:            https://www.frrouting.org
+Requires(preun): info
+Requires(post): info
 BuildRequires:  gcc patch libcap-devel
-BuildRequires:  readline readline-devel ncurses ncurses-devel
+BuildRequires:  readline-devel ncurses-devel
 BuildRequires:  json-c-devel bison >= 2.7 flex make
 BuildRequires:  c-ares-devel texinfo
 %if 0%{?rhel} && 0%{?rhel} < 7
@@ -160,14 +155,12 @@ BuildRequires:  python27-devel python27-sphinx
 %else
 BuildRequires:  python-devel >= 2.7 python-sphinx
 %endif
-Requires:       ncurses json-c initscripts
+Requires:       json-c initscripts
 %if %{with_pam}
 BuildRequires:  pam-devel
-Requires:       pam
 %endif
 %if %{with_rpki}
 BuildRequires:  librtr-devel >= 0.5
-Requires:       librtr >= 0.5
 %endif
 %if "%{initsystem}" == "systemd"
 BuildRequires:      systemd systemd-devel
@@ -175,6 +168,8 @@ Requires(post):     systemd
 Requires(preun):    systemd
 Requires(postun):   systemd
 %else
+Requires(post):     chkconfig
+Requires(preun):    chkconfig
 # Initscripts > 5.60 is required for IPv6 support
 Requires(pre):      initscripts >= 5.60
 %endif
@@ -203,7 +198,7 @@ Contributed/3rd party tools which may be of use with frr.
 %package pythontools
 Summary: python tools for frr
 BuildRequires: python
-Requires: python python-ipaddr
+Requires: python-ipaddr
 Group: System Environment/Daemons
 
 %description pythontools
@@ -235,10 +230,8 @@ developing OSPF-API and frr applications.
 
 %configure \
     --sbindir=%{_sbindir} \
-    --sysconfdir=%{_sysconfdir} \
-    --libdir=%{_libdir} \
-    --libexecdir=%{_libexecdir} \
-    --localstatedir=%{_localstatedir} \
+    --sysconfdir=%{configdir} \
+    --localstatedir=%{rundir} \
     --disable-werror \
     --enable-irdp \
 %if !%{with_shared}
@@ -254,14 +247,14 @@ developing OSPF-API and frr applications.
     --disable-ospfclient\
 %endif
 %if %{with_ospfapi}
-    --enable-ospfapi=yes \
+    --enable-ospfapi \
 %else
-    --enable-ospfapi=no \
+    --disable-ospfapi \
 %endif
 %if %{with_rtadv}
-    --enable-rtadv=yes \
+    --enable-rtadv \
 %else
-    --enable-rtadv=no \
+    --disable-rtadv \
 %endif
 %if %{with_ldpd}
     --enable-ldpd \
@@ -279,19 +272,19 @@ developing OSPF-API and frr applications.
     --disable-pbrd \
 %endif
 %if %{with_nhrpd}
-       --enable-nhrpd \
+    --enable-nhrpd \
 %else
-       --disable-nhrpd \
+    --disable-nhrpd \
 %endif
 %if %{with_eigrpd}
-       --enable-eigrpd \
+    --enable-eigrpd \
 %else
-       --disable-eigrpd \
+    --disable-eigrpd \
 %endif
 %if %{with_babeld}
-       --enable-babeld \
+    --enable-babeld \
 %else
-       --disable-babeld \
+    --disable-babeld \
 %endif
 %if %{with_pam}
     --with-libpam \
@@ -318,13 +311,14 @@ developing OSPF-API and frr applications.
 %else
     --disable-bgp-vnc \
 %endif
-    --enable-isisd=yes \
+    --enable-isisd \
 %if "%{initsystem}" == "systemd"
-    --enable-systemd=yes \
+    --enable-systemd \
 %endif
-    --enable-poll=yes
 %if %{with_rpki}
     --enable-rpki
+%else
+    --disable-rpki
 %endif
 
 make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" SPHINXBUILD=%{sphinx}
@@ -385,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
@@ -399,7 +393,7 @@ fi
 
 zebra_spec_add_service ()
 {
-    # Add port /etc/services entry if it isn't already there 
+    # 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
@@ -446,43 +440,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' %{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
@@ -534,18 +534,18 @@ rm -rf %{buildroot}
 %defattr(-,root,root)
 %doc */*.sample* AUTHORS COPYING
 %doc doc/mpls
-%doc ChangeLog NEWS README SERVICES
+%doc ChangeLog NEWS README
 %if 0%{?frr_user:1}
-%dir %attr(751,%frr_user,%frr_user) %{_sysconfdir}
-%dir %attr(750,%frr_user,%frr_user) /var/log/frr 
+%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*/*
@@ -586,19 +586,21 @@ rm -rf %{buildroot}
 %if %{with_fpm}
 %attr(755,root,root) %{_libdir}/frr/modules/zebra_fpm.so
 %endif
+%if %{with_rpki}
+%attr(755,root,root) %{_libdir}/frr/modules/bgpd_rpki.so
+%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
 %if "%{initsystem}" == "systemd"
-    %attr(644,root,root) %{_unitdir}/frr.service
-    %{_sbindir}/frr
+    %{_unitdir}/frr.service
 %else
     /etc/rc.d/init.d/frr
-    %{_sbindir}/frr
 %endif
+%{_sbindir}/frr
 %config(noreplace) /etc/pam.d/frr
-%config(noreplace) %attr(640,root,root) /etc/logrotate.d/*
+%config(noreplace) /etc/logrotate.d/frr
 %{_sbindir}/frr-reload
 
 %files contrib
@@ -632,7 +634,10 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
-* Sun Mar  4 2018 Martin Winter <mwinter@opensourcerouting.org> - %{version}
+* Sun May 20 2018 Martin Winter <mwinter@opensourcerouting.org> - %{version}
+- Fixed RPKI RPM build
+
+* Sun Mar  4 2018 Martin Winter <mwinter@opensourcerouting.org>
 - Add option to build with RPKI (default: disabled)
 
 * Tue Feb 20 2018 Martin Winter <mwinter@opensourcerouting.org>
@@ -649,13 +654,13 @@ rm -rf %{buildroot}
 - 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
-- created systemd service file for systemd based systems (which uses init script) 
+- created systemd service file for systemd based systems (which uses init script)
 - Various other RPM package fixes for FRR 2.0
 
 * Fri Jan  6 2017 Martin Winter <mwinter@opensourcerouting.org>
 - Renamed to frr for FRRouting fork of Quagga
 
-* Thu Feb 11 2016 Paul Jakma <paul@jakma.org> 
+* Thu Feb 11 2016 Paul Jakma <paul@jakma.org>
 - remove with_ipv6 conditionals, always build v6
 - Fix UTF-8 char in spec changelog
 - remove quagga.pam.stack, long deprecated.
@@ -666,7 +671,7 @@ rm -rf %{buildroot}
 - Remove support for old fedora 4/5
 - Fix for package nameing
 - Fix Weekdays of previous changelogs (bogus dates)
-- Add conditional logic to only build tex footnotes with supported texi2html 
+- Add conditional logic to only build tex footnotes with supported texi2html
 - Added pimd to files section and fix double listing of /var/lib*/quagga
 - Numerous fixes to unify upstart/systemd startup into same spec file
 - Only allow use of watchfrr for non-systemd systems. no need with systemd
@@ -759,7 +764,7 @@ rm -rf %{buildroot}
 - walk up tree - 17218
 - ospfd NSSA fixes - 16681
 - ospfd nsm fixes - 16824
-- ospfd OLSA fixes and new feature - 16823 
+- ospfd OLSA fixes and new feature - 16823
 - KAME and ifindex fixes - 16525
 - spec file changes to allow redhat files to be in tree
 
@@ -817,7 +822,7 @@ rm -rf %{buildroot}
 * Tue Feb  6 2001 Tim Powers <timp@redhat.com>
 - built for Powertools
 
-* Sun Feb  4 2001 Pekka Savola <pekkas@netcore.fi> 
+* Sun Feb  4 2001 Pekka Savola <pekkas@netcore.fi>
 - Hacked up from PLD Linux 0.90-1, Mandrake 0.90-1mdk and one from zebra.org.
 - Update to 0.91a
 - Very heavy modifications to init.d/*, .spec, pam, i18n, logrotate, etc.