Blob Blame History Raw
%define _hardened_build 1

Name:           babeld
Version:        1.3.4
Release:        4%{?dist}
Summary:        Ad-hoc network routing daemon

Group:          System Environment/Base
License:        MIT
URL:            http://www.pps.univ-paris-diderot.fr/~jch/software/babel/
Source0:        http://www.pps.univ-paris-diderot.fr/~jch/software/files/%{name}-%{version}.tar.gz
Source1:        %{name}.service
Source2:        %{name}.conf
Source3:        %{name}.logrotate
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Conflicts:      quagga

%description
Babel is a loop-avoiding distance-vector routing protocol roughly
based on HSDV and AODV, but with provisions for link cost estimation
and redistribution of routes from other routing protocols.

%prep
%setup -q

%build
make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}


%install
install -Dpm 755 babeld $RPM_BUILD_ROOT%{_sbindir}/babeld
install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
install -Dpm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/babeld.conf
install -Dpm 644 babeld.man $RPM_BUILD_ROOT/%{_mandir}/man8/babeld.8
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/
install -Dp -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/babeld

%post
if [ $1 -eq 1 ] ; then
    # Initial installation
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
  
%preun
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi

%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi


%files
%doc CHANGES LICENCE README
%{_sbindir}/babeld
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/babeld.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/babeld
%{_mandir}/man8/babeld.8.*
%ghost %attr(0600,root,root) %{_localstatedir}/lib/babel-state
%ghost %attr(0600,root,root) %{_localstatedir}/log/babel.log


%changelog
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Sep 04 2012 Jon Ciesla <limburgher@gmail.com> - 1.3.4-3
- Conflict with quagga and it's babeld.

* Thu Aug 23 2012 Jon Ciesla <limburgher@gmail.com> - 1.3.4-2
- Dropped unneeded parts for review.
- Added log, logrotate, state file, and default config.

* Tue Aug 21 2012 Jon Ciesla <limburgher@gmail.com> - 1.3.4-1
- Initial package.