File xl2tpd.spec of Package xl2tpd

#
# spec file for package xl2tpd (Version 1.2.4)
#
# Copyright (c) 2010 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/
#


Summary:        Layer 2 Tunnelling Protocol Daemon (RFC 2661)

Name:           xl2tpd
Version:        1.2.4
Release:        2
License:        GPLv2
Url:            http://www.xelerance.com/software/xl2tpd/
Group:          Productivity/Networking/System
Source0:        %{name}-%{version}.tar.bz2
Patch0:         Makefile.patch
Patch1:         xl2tpd.init.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       ppp
%if %sles_version >= 10
BuildRequires:  libpcap linux-kernel-headers => 2.6.23
%endif
BuildRequires:  libpcap-devel linux-kernel-headers
Obsoletes:      l2tpd <= 0.68
Provides:       l2tpd = 0.69

%description
xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
L2TP allows you to tunnel PPP over UDP. Some ISPs use L2TP to tunnel user
sessions from dial-in servers (modem banks, ADSL DSLAMs) to back-end PPP
servers. Another important application is Virtual Private Networks where
the IPsec protocol is used to secure the L2TP connection (L2TP/IPsec,
RFC 3193). The L2TP/IPsec protocol is mainly used by Windows and
Mac OS X clients. On Linux, xl2tpd can be used in combination with IPsec
implementations such as Openswan.
Example configuration files for such a setup are included in this RPM.

xl2tpd works by opening a pseudo-tty for communicating with pppd.
It runs completely in userspace but supports kernel mode L2TP.

xl2tpd supports IPsec SA Reference tracking to enable overlapping internak
NAT'ed IP's by different clients (eg all clients connecting from their
linksys internal IP 192.168.1.101) as well as multiple clients behind
the same NAT router.

xl2tpd supports the pppol2tp kernel mode operations on 2.6.23 or higher,
or via a patch in contrib for 2.4.x kernels.

Xl2tpd is based on the 0.69 L2TP by Jeff McAdams <jeffm@iglou.com>
It was de-facto maintained by Jacco de Leeuw <jacco2@dds.nl> in 2002 and 2003.

%package -n xl2tpd-doc
License:        GPLv2
Summary:        Documentation for xl2tpd package
Group:          Documentation/Man
Version:        1.2.4
Release:        2
AutoReqProv:    on

%description -n xl2tpd-doc
This package contains the documentation for using the xl2tpd daemon

%prep
%setup -q

%patch0
%patch1

%build
make DFLAGS="$RPM_OPT_FLAGS" 

%install
export PREFIX=/usr
make DESTDIR=%{buildroot} MANDIR=%{buildroot}/%{_mandir} install
install -p -D -m644 examples/xl2tpd.conf %{buildroot}%{_sysconfdir}/xl2tpd/xl2tpd.conf
install -p -D -m644 examples/ppp-options.xl2tpd %{buildroot}%{_sysconfdir}/ppp/options.xl2tpd
install -p -D -m600 doc/l2tp-secrets.sample %{buildroot}%{_sysconfdir}/xl2tpd/l2tp-secrets
install -p -D -m600 examples/chapsecrets.sample %{buildroot}%{_sysconfdir}/ppp/chap-secrets.sample
install -p -D -m755 packaging/suse/xl2tpd.init %{buildroot}%{_initrddir}/xl2tpd
ln -sf /etc/init.d/xl2tpd $RPM_BUILD_ROOT/%{_sbindir}/rcxl2tpd
install -p -D -m755 -d %{buildroot}%{_localstatedir}/run/xl2tpd  

%clean
rm -rf %{buildroot}

%post
%{fillup_and_insserv xl2tpd}

# if we migrate from l2tpd to xl2tpd, copy the configs
if [ -f /etc/l2tpd/l2tpd.conf ]
then
	echo "Old /etc/l2tpd configuration found, migrating to /etc/xl2tpd"
	mv /etc/xl2tpd/xl2tpd.conf /etc/xl2tpd/xl2tpd.conf.rpmsave
	cat /etc/l2tpd/l2tpd.conf | sed "s/options.l2tpd/options.xl2tpd/" > /etc/xl2tpd/xl2tpd.conf
	mv /etc/ppp/options.xl2tpd /etc/ppp/options.xl2tpd.rpmsave
	mv /etc/ppp/options.l2tpd /etc/ppp/options.xl2tpd
	mv /etc/xl2tpd/l2tp-secrets /etc/xl2tpd/l2tpd-secrets.rpmsave
	cp -pa /etc/l2tpd/l2tp-secrets /etc/xl2tpd/l2tp-secrets

fi

%preun
%stop_on_removal xl2tpd
exit 0

%postun
%restart_on_update xl2tpd
%insserv_cleanup
exit 0

%files
%defattr(-,root,root)
%{_sbindir}/rcxl2tpd
%{_sbindir}/xl2tpd
%{_bindir}/pfc
%dir %{_sysconfdir}/xl2tpd
%config(noreplace) %{_sysconfdir}/xl2tpd/*
%config(noreplace) %{_sysconfdir}/ppp/*
%attr(0755,root,root)  %{_initrddir}/xl2tpd
%ghost %{_localstatedir}/run/xl2tpd

%files -n xl2tpd-doc
%defattr(-,root,root)
%doc BUGS CHANGES CREDITS LICENSE README.* TODO doc/rfc2661.txt
%doc doc/README.patents examples/chapsecrets.sample
%{_mandir}/*/*

%changelog
openSUSE Build Service is sponsored by