File quagga.spec of Package quagga.import5276

#
# spec file for package quagga
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           quagga
Version:        0.99.17
Release:        4.<RELEASE11>
License:        LGPLv2.1+
Summary:        Free Routing Software (for BGP, OSPF and RIP, for example)
Url:            http://www.quagga.net
Group:          Productivity/Networking/Routing
Source:         http://www.quagga.net/download/%{name}-%{version}.tar.gz
Source1:        %{name}-SUSE.tar.bz2
Source2:        %{name}.pam
Patch0:         %{name}-0.99.17-CVE-2010-1674.patch
Patch1:         %{name}-0.99.17-CVE-2010-1675.patch
Patch2:         bug-718056_quagga-0.99.18-514840.patch
Patch3:         bug-718058_quagga-master-514839.patch
Patch4:         bug-718059_quagga-master-514838.1.patch
Patch5:         bug-718059_quagga-master-514838.2.patch
Patch6:         bug-718061_quagga-master-514837.patch
Patch7:         bug-718062_quagga-master-513254.patch
BuildRequires:  net-snmp-devel
BuildRequires:  pam-devel
BuildRequires:  readline-devel
PreReq:         %fillup_prereq
PreReq:         %insserv_prereq
PreReq:         %install_info_prereq
# pwdutils for useradd and groupadd
PreReq:         pwdutils
Recommends:     logrotate
Provides:       zebra
Obsoletes:      zebra
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Quagga is a routing software suite, providing implementations of
OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms,
particularly FreeBSD and Linux and also NetBSD, to mention a few.
Quagga is a fork of GNU Zebra which was developed by Kunihiro Ishiguro.
The Quagga tree aims to build a more involved community around Quagga
than the current centralised model of GNU Zebra.

%package      devel
License:        LGPLv2.1+
Summary:        Free Routing Software (for BGP, OSPF and RIP, for example)
Group:          Productivity/Networking/Routing
Requires:       %{name} = %{version}

%description devel
Quagga is a routing software suite, providing implementations of
OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms,
particularly FreeBSD and Linux and also NetBSD, to mention a few.
Quagga is a fork of GNU Zebra which was developed by Kunihiro Ishiguro.
The Quagga tree aims to build a more involved community around Quagga
than the current centralised model of GNU Zebra.

%prep
%setup -q -a 1
%patch0 -p 1
%patch1 -p 1
%patch2 -p 1
%patch3 -p 1
%patch4 -p 1
%patch5 -p 1
%patch6 -p 1
%patch7 -p 1

%build
if ! ls /proc/net/{dev,route,snmp} >/dev/null; then
    echo "ERROR: /proc is not mounted" >&2;
    exit 1;
fi
rm -f m4/libtool.m4 m4/lt*.m4
autoreconf --force --install
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure --disable-static --with-pic \
    --enable-vtysh \
    --enable-rtadv \
    --enable-snmp \
    --enable-ipv6 \
    --with-libpam \
    --enable-netlink \
    --sysconfdir=%{_sysconfdir}/quagga \
    --localstatedir=%{_localstatedir}/run/quagga \
    --enable-multipath=0
make %{?_smp_mflags}

%install
rm -r doc/quagga.info
make DESTDIR=%{buildroot} install
rm -rf %{buildroot}%{_libdir}/lib{ospf,zebra}.la
install -d %{buildroot}%{_sysconfdir}/{init.d,quagga,pam.d,logrotate.d}
install -m 755 SUSE/* %{buildroot}%{_sysconfdir}/init.d/
install -m 644 %{S:2} %{buildroot}%{_sysconfdir}/pam.d/quagga
install -d -m 750 %{buildroot}%{_localstatedir}/log/quagga
install -d -m 751 %{buildroot}%{_localstatedir}/run/quagga
install -m 644 redhat/quagga.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/quagga
ln -sf %{_sysconfdir}/init.d/zebra  %{buildroot}%{_sbindir}/rczebra
ln -sf %{_sysconfdir}/init.d/bgpd   %{buildroot}%{_sbindir}/rcbgpd
ln -sf %{_sysconfdir}/init.d/ospf6d %{buildroot}%{_sbindir}/rcospf6d
ln -sf %{_sysconfdir}/init.d/ospfd  %{buildroot}%{_sbindir}/rcospfd
ln -sf %{_sysconfdir}/init.d/ripngd %{buildroot}%{_sbindir}/rcripngd
ln -sf %{_sysconfdir}/init.d/ripd   %{buildroot}%{_sbindir}/rcripd
rm -f %{buildroot}%{_sysconfdir}/quagga/*.sample*
cat > %{buildroot}%{_sysconfdir}/quagga/zebra.conf << __EOF__
hostname quagga
password quagga
enable password quagga
log file %{_localstatedir}/log/quagga/quagga.log
__EOF__
touch %{buildroot}%{_sysconfdir}/quagga/vtysh.conf

%pre
%{_sbindir}/groupadd -r quagga 2> /dev/null || :
%{_sbindir}/useradd -r -g quagga -s %{_bindir}/false \
                  -c "Quagga routing daemon" \
                  -d %{_localstatedir}/run/quagga quagga 2> /dev/null || :

%post
/sbin/ldconfig
%fillup_and_insserv
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%preun
%stop_on_removal zebra bgpd ospf6d ospfd ripd ripngd

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
%restart_on_update zebra bgpd ospf6d ospfd ripd ripngd
%insserv_cleanup
/sbin/ldconfig

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc */*.sample* AUTHORS COPYING* ChangeLog NEWS README REPORTING-BUGS SERVICES TODO
%{_sbindir}/*
%config %{_sysconfdir}/quagga/
%config(noreplace) %{_sysconfdir}/logrotate.d/*
%config %{_sysconfdir}/init.d/*
%config (noreplace)%{_sysconfdir}/pam.d/*
%{_bindir}/*
%dir %attr(-,quagga,quagga) %{_localstatedir}/log/quagga
%dir %attr(-,quagga,quagga) %ghost %{_localstatedir}/run/quagga
%{_infodir}/quagga.info*
%{_mandir}/man?/*
%attr(755,root,root) %{_libdir}/lib*.so.*

%files devel
%defattr(644,root,root,755)
%{_libdir}/*.so
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*.h
%dir %{_includedir}/%{name}/ospfd
%{_includedir}/%{name}/ospfd/*.h

%changelog