File ratools.spec of Package ratools

#
# spec file for package ratools
#
# Copyright (c) 2016, Martin Hauke <mardnh@gmx.de>
#
# 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:           ratools
Version:        0.6.2
Release:        0
Summary:        Router Advertisement Tools
License:        Apache-2.0
Group:          Productivity/Networking/Routing
URL:            https://github.com/danrl/ratools
#Git-Clone:     https://github.com/danrl/ratools.git
Source:         https://github.com/danrl/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0:         ratools-use-sbin-for-rad.diff
BuildRequires:  bash-completion
Requires:       bash-completion

%description
This is ratools, a fast, dynamic, multi-threading framework for creating,
modifying and sending IPv6 Router Advertisements (RA).

%prep
%setup -q
%patch0 -p1

%build
export CFLAGS="%{optflags}"
cd src
make %{?_smp_mflags}

%install
install -Dpm0755 bin/ractl "%{buildroot}/%{_bindir}/ractl"
install -Dpm0755 bin/rad "%{buildroot}/%{_sbindir}/rad"
install -Dpm0644 man/rad.8 "%{buildroot}/%{_mandir}/man8/rad.8"
install -Dpm0644 man/ractl.8 "%{buildroot}/%{_mandir}/man8/ractl.8"
install -Dpm0644 bash-completion.d/ractl.sh "%{buildroot}%{_datadir}/bash-completion/completions/ractl"
install -Dpm0644 systemd/ratools-rad.service "%{buildroot}%{_unitdir}/ratools-rad.service"
install -Dpm0644 systemd/ratools-rad.socket "%{buildroot}%{_unitdir}/ratools-rad.socket"
mkdir -p "%{buildroot}%{_sysconfdir}/ratools"
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcratools-rad

%pre
%service_add_pre ratools-rad.service
%service_add_pre ratools-rad.socket

%post
%service_add_post ratools-rad.service
%service_add_post ratools-rad.socket

%preun
%service_del_preun ratools-rad.service
%service_del_preun ratools-rad.socket

%postun
%service_del_postun ratools-rad.service
%service_del_postun ratools-rad.socket

%files
%license LICENSE
%doc README.md
%doc example.conf
%{_bindir}/ractl
%{_sbindir}/rad
%{_sbindir}/rcratools-rad
%{_mandir}/man8/ractl.8%{?ext_man}
%{_mandir}/man8/rad.8%{?ext_man}
%{_datadir}/bash-completion/completions/ractl
%{_sysconfdir}/ratools
%{_unitdir}/ratools-rad.service
%{_unitdir}/ratools-rad.socket

%changelog
openSUSE Build Service is sponsored by