lkundrak / rpms / clatd

Forked from rpms/clatd 4 years ago
Clone
Blob Blame History Raw
%global commit0 1abcec1285585ede73b937b4082828755ee9c61c
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})

Name:		clatd
Version:	1.4
Release:	2%{?dist}
Summary:	CLAT / SIIT-DC Edge Relay implementation for Linux

Group:		System Environment/Daemons
License:	MIT
URL:		https://github.com/toreanderson/%{name}
Source0:	https://github.com/toreanderson/clatd/archive/v1.4.tar.gz

# Upstream patch 9a1a4ae correcting the license inside the clatd source to 
# match the one in the LICENSE file. Acknowledged by upstream author. 
Patch1:		clatd-1.4_fix_license_9a1a4ae.patch

# Upstream patches 1abcec1 and 18dca08, with documentation fixes
Patch2:		clatd-1.4_fix_doc_1abcec1+18dca08.patch

# Upstream patch fb4587b with NetworkManager script fix
Patch3:		clatd-1.4_fix_nm_script_fb4587b.patch

BuildArch:	noarch
BuildRequires:	perl
BuildRequires:	coreutils
BuildRequires:	%{_bindir}/pod2man

Requires:	iproute
Requires:	iptables
Requires:	tayga
Requires:	perl
Requires:	perl(Net::DNS)
Requires:	perl(IO::Socket::INET6)
Requires:	perl(File::Temp)

%if 0%{?fedora} >= 18 || 0%{?rhel} >=7
Requires(post):		systemd
Requires(preun):	systemd
Requires(postun):	systemd
BuildRequires:		systemd
%endif


%description
clatd implements the CLAT component of the 464XLAT network architecture
specified in RFC 6877. It allows an IPv6-only host to have IPv4
connectivity that is translated to IPv6 before being routed to an upstream
PLAT (which is typically a Stateful NAT64 operated by the ISP) and there
translated back to IPv4 before being routed to the IPv4 internet.


%prep
%setup -q v%{release}.tar.gz
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
pod2man	--name %{name} \
	--center "clatd - a CLAT implementation for Linux" \
	--section 8 \
	README.pod %{name}.8
gzip %{name}.8
echo '# Default clatd.conf
# See clatd(8) for a list of config directives' > %{name}.conf

sed -i "s,%{_sbindir}/clatd,%{_sbindir}/clatd -c %{_sysconfdir}/%{name}.conf," \
	scripts/*


%install
install -p -D -m0755 %{name} %{buildroot}%{_sbindir}/%{name}
install -p -D -m0644 %{name}.8.gz %{buildroot}%{_mandir}/man8/%{name}.8.gz
install -p -D -m0644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
install -p -D -m0755 scripts/%{name}.networkmanager %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/50-%{name}
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
install -p -D -m 0644 scripts/%{name}.systemd %{buildroot}%{_unitdir}/%{name}.service
%else
install -p -D -m0644 scripts/%{name}.upstart %{buildroot}%{_sysconfdir}/init/%{name}.conf;
%endif

%post
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%systemd_post %{name}.service
%else
# upstart services do not need any chkconfig to be enabled
%endif


%files
%defattr(-,root,root,-)
%{_sbindir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}.conf
%{_sysconfdir}/NetworkManager/dispatcher.d/
%doc README.pod
%{_mandir}/man8/*.8*
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 7
%license LICENCE
%else
%doc LICENCE
%endif
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%{_unitdir}/%{name}.service
%else
%{_sysconfdir}/init/%{name}.conf
%endif


%changelog
* Tue Jun 28 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4-2
- Fixes for bz#1302876, including
- Now BuildRequires pod2man
- Requires perl(Net::IP) is autogenerated, so not needed explicit
- clatd.conf is marked as config file
- Packaged 1.4 release tarball, and added changes from upstream as patches

* Tue Feb 23 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4-1.3.20160128git1abcec1
- Package now (co)owns /etc/NetworkManager/dispatcher.d, and no longer
  requires initscripts (bz #1302876)

* Thu Jan 28 2016 Ingvar Hagelund <ingvar@redpill-linpro.com> 1.4-1.2.20160128git1abcec1
- First wrap for fedora and epel