File rp-pppoe.spec of Package rp-pppoe

#
# spec file for package rp-pppoe
#
# Copyright (c) 2016 SUSE LINUX 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/
#


#
%if 0%{?suse_version} > 1140
%define has_systemd 1
%endif

Name:           rp-pppoe
Summary:        A PPP Over Ethernet Redirector for PPPD
License:        GPL-2.0+
Group:          Productivity/Networking/PPP
Version:        3.12
Release:        0
Source0:        https://www.roaringpenguin.com/files/download/%{name}-%{version}.tar.gz
Source1:        pppoe-connect
Source2:        pppoe-setup
Source3:        pppoe-start
Source4:        pppoe-status
Source5:        pppoe-stop
Source6:        pppoe-server.service
Url:            https://www.roaringpenguin.com/products/pppoe
Patch0:         docdir.diff
Patch1:         nonrfc-modems.diff
Patch2:         release-buildsystem.diff
Patch3:         resolve-conf.diff
Patch4:         rp-pppoe-3.10-config.patch
Patch5:         rp-pppoe-3.10-init.patch
Patch6:         rp-pppoe-pie.patch
Patch7:         strip.diff
Requires:       net-tools
Requires:       ppp
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  ppp
%if 0%{?has_systemd}
BuildRequires:  systemd
%else
PreReq:         %insserv_prereq %fillup_prereq
%endif

%description
rp-pppoe is a user-space redirector which permits the use of PPPoE
(Point-to-Point Protocol Over Ethernet) with Linux. PPPoE is used by
many ADSL service providers.

%prep
%setup -q
%patch0
%patch1
%patch2
%patch3
%patch4 -p1
%patch5 -p1
%patch6
%patch7

%build
cd src
%configure
make %{?_smp_mflags}
cd ../gui
make %{?_smp_mflags}

%install
%make_install -C src
%if 0%{?has_systemd}
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -m 0755 %{SOURCE1} %{buildroot}%{_sbindir}
install -m 0755 %{SOURCE2} %{buildroot}%{_sbindir}
install -m 0755 %{SOURCE3} %{buildroot}%{_sbindir}
install -m 0755 %{SOURCE4} %{buildroot}%{_sbindir}
install -m 0755 %{SOURCE5} %{buildroot}%{_sbindir}
install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/pppoe-server.service
ln -sf pppoe-stop %{buildroot}%{_sbindir}/adsl-stop
ln -sf pppoe-start %{buildroot}%{_sbindir}/adsl-start
rm -rf %{buildroot}/etc/ppp/pppoe.conf \
       %{buildroot}/etc/rc.d/init.d/pppoe \
       %{buildroot}/etc/init.d
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcpppoe-server
%else
%{__ln_s} -f ../../etc/init.d/pppoe %{buildroot}%{_sbindir}/rcpppoe
%endif
%make_install -C gui
install -d  %{buildroot}%_defaultdocdir/rp-pppoe
mv %{buildroot}/etc/ppp/plugins/README %{buildroot}%_defaultdocdir/rp-pppoe/README.plugins
%{__rm} -rf %{buildroot}%{_sysconfdir}/ppp/plugins

%if 0%{?has_systemd}
%pre
%service_add_pre pppoe-server.service

%preun
%service_del_preun pppoe-server.service
%else
%stop_on_removal pppoe
%endif

%post
%if 0%{?has_systemd}
%service_add_post pppoe-server.service
%else
%{fillup_and_insserv pppoe}
%endif

%postun
%if 0%{?has_systemd}
%service_del_postun pppoe-server.service
%else
%restart_on_update pppoe
%{insserv_cleanup}
%endif

%files
%defattr(-,root,root)
%dir %_defaultdocdir/rp-pppoe
%doc %_defaultdocdir/rp-pppoe/*
%config(noreplace) /etc/ppp/pppoe-server-options
%config(noreplace) /etc/ppp/firewall-masq
%config(noreplace) /etc/ppp/firewall-standalone
%{_bindir}/tkpppoe
%{_sbindir}/pppoe
%{_sbindir}/pppoe-server
%{_sbindir}/pppoe-sniff
%{_sbindir}/pppoe-relay
%{_sbindir}/pppoe-connect
%{_sbindir}/pppoe-start
%{_sbindir}/pppoe-stop
%{_sbindir}/pppoe-setup
%{_sbindir}/pppoe-status
%attr (4750,root,dialout) %{_sbindir}/pppoe-wrapper
%{_mandir}/man5/pppoe.conf.5*
%{_mandir}/man8/pppoe.8*
%{_mandir}/man8/pppoe-server.8*
%{_mandir}/man8/pppoe-relay.8*
%{_mandir}/man8/pppoe-sniff.8*
%{_mandir}/man8/pppoe-connect.8*
%{_mandir}/man8/pppoe-start.8*
%{_mandir}/man8/pppoe-stop.8*
%{_mandir}/man8/pppoe-status.8*
%{_mandir}/man8/pppoe-setup.8*
%if 0%{?has_systemd}
%{_sbindir}/adsl-start
%{_sbindir}/adsl-stop
%{_sbindir}/rcpppoe-server
%{_unitdir}/pppoe-server.service
%else
/etc/init.d/pppoe
%{_sbindir}/rcpppoe
%config(noreplace) /etc/ppp/pppoe.conf
%endif
%dir /etc/ppp/rp-pppoe-gui
%{_mandir}/man1/tkpppoe.1*
%{_mandir}/man1/pppoe-wrapper.1*
%dir /usr/share/tkpppoe
/usr/share/tkpppoe/tkpppoe.html
/usr/share/tkpppoe/mainwin-busy.png
/usr/share/tkpppoe/mainwin-nonroot.png
/usr/share/tkpppoe/mainwin.png
/usr/share/tkpppoe/props-advanced.png
/usr/share/tkpppoe/props-basic.png
/usr/share/tkpppoe/props-nic.png
/usr/share/tkpppoe/props-options.png
/usr/share/tkpppoe/en.msg
/usr/share/tkpppoe/ja.msg

%changelog
openSUSE Build Service is sponsored by