Accepting request 545313 from home:13ilya:branches:network

- Refresh spec-file via spec-cleaner.
- Add ppp-modem package for automatic redial to mobile provider.

OBS-URL: https://build.opensuse.org/request/show/545313
OBS-URL: https://build.opensuse.org/package/show/network/ppp?expand=0&rev=45
This commit is contained in:
OBS User mrdocs 2017-12-02 04:17:03 +00:00 committed by Git OBS Bridge
parent 291f847d16
commit d4a837a1b8
6 changed files with 122 additions and 33 deletions

18
modem-peers Normal file
View File

@ -0,0 +1,18 @@
460800
defaultroute
usepeerdns
crtscts
lock
noauth
local
persist
modem
nopcomp
novjccomp
nobsdcomp
nodeflate
noaccomp
ipcp-accept-local
ipcp-accept-remote
noipdefault
connect "/usr/sbin/chat -t10 -f /etc/ppp/chatscripts/modem.chat"

19
modem.chat Normal file
View File

@ -0,0 +1,19 @@
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 5
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
'OK-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'OK' 'AT\^SYSCFG=2,2,3fffffff,0,1'
'OK-AT-OK' 'AT+CGDCONT=1,"IP","internet.mts.ru"'
'OK' 'ATDT*99#'
CONNECT

1
modem.rules Normal file
View File

@ -0,0 +1 @@
KERNEL=="ttyACM[0-9]*", TAG+="systemd", ENV{SYSTEMD_WANTS}="modem@%n.service"

13
modem@.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Modem /dev/ttyACM%i
BindsTo=dev-ttyACM%i.device
After=dev-ttyACM%i.device
Before=network.target
Wants=network.target
[Service]
Group=dialout
ExecStart=/usr/sbin/pppd call modem /dev/ttyACM%i
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 24 19:18:37 UTC 2017 - ilya@ilya.pp.ua
- Refresh spec-file via spec-cleaner.
- Add ppp-modem package for automatic redial to mobile provider.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Nov 23 14:47:28 UTC 2017 - ilya@ilya.pp.ua Thu Nov 23 14:47:28 UTC 2017 - ilya@ilya.pp.ua

View File

@ -12,22 +12,18 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org
# #
%define _group dialout %define _group dialout
Name: ppp Name: ppp
BuildRequires: libpcap-devel
BuildRequires: linux-atm-devel
BuildRequires: pam-devel
Url: http://ppp.samba.org/
Version: 2.4.7 Version: 2.4.7
Release: 0 Release: 0
Summary: The Point to Point Protocol for Linux Summary: The Point to Point Protocol for Linux
License: BSD-3-Clause and LGPL-2.1+ and GPL-2.0+ License: BSD-3-Clause AND LGPL-2.1+ AND GPL-2.0+
Group: Productivity/Networking/PPP Group: Productivity/Networking/PPP
BuildRoot: %{_tmppath}/%{name}-%{version}-build URL: https://ppp.samba.org
Source0: ftp://ftp.samba.org/pub/ppp/ppp-%{version}.tar.gz Source0: https://download.samba.org/pub/%{name}/%{name}-%{version}.tar.gz
# config for pam # config for pam
Source1: ppp.pamd Source1: ppp.pamd
# templates for secrets # templates for secrets
@ -37,12 +33,17 @@ Source3: chap-secrets.template
Source5: options Source5: options
Source6: filters Source6: filters
# several peers file # several peers file
Source7: modem-peers
Source8: pppoe-peers Source8: pppoe-peers
Source9: pppoe-rp-peers Source9: pppoe-rp-peers
Source10: pppoatm-peers Source10: pppoatm-peers
Source11: ppp-peers Source11: ppp-peers
Source12: pptp-peers Source12: pptp-peers
Source13: pppoe-discovery.8.gz Source13: pppoe-discovery.8.gz
# modem files
Source14: modem.chat
Source15: modem@.service
Source16: modem.rules
# Makefile changes # Makefile changes
Patch0: ppp-2.4.6-make.diff Patch0: ppp-2.4.6-make.diff
# replacedefaultroute option # replacedefaultroute option
@ -72,6 +73,9 @@ Patch23: ppp-send-padt.patch
# PATCH-FIX-UPSTREAM -- Patch for CVE-2015-3310 # PATCH-FIX-UPSTREAM -- Patch for CVE-2015-3310
Patch24: ppp-CVE-2015-3310.patch Patch24: ppp-CVE-2015-3310.patch
Patch25: fix-header-conflict.patch Patch25: fix-header-conflict.patch
BuildRequires: libpcap-devel
BuildRequires: linux-atm-devel
BuildRequires: pam-devel
%if 0%{?suse_version} >= 1330 %if 0%{?suse_version} >= 1330
Requires: group(%{_group}) Requires: group(%{_group})
Requires(pre): group(%{_group}) Requires(pre): group(%{_group})
@ -90,12 +94,30 @@ interface and performing the PPP negotiations.
%package devel %package devel
Summary: Header Files Required for Developing Plugins for pppd Summary: Header Files Required for Developing Plugins for pppd
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: ppp = %version Requires: ppp = %{version}
%description devel %description devel
The package ppp-devel contains C header files required for developing The package ppp-devel contains C header files required for developing
plugins for the pppd. plugins for the pppd.
%package modem
Summary: Automatic redial for any USB modem supported by the kernel
Group: System/Kernel
Requires: group(dialout)
Requires: ppp
Requires: udev
BuildArch: noarch
%description modem
This package contains peer, chat script, systemd unit and udev rule for
automatic redial when connecting any USB modem supported by the kernel.
For disable automatic redial (by default enabled for all), run
sudo systemctl mask modem@0.service
For enable again automatic redial, run
sudo systemctl unmask modem@0.service
"0" after "@" is the serial number of the modem, if you have more than one,
you can disable unnecessary or disable everything.
%prep %prep
%setup -q %setup -q
%patch0 %patch0
@ -113,7 +135,7 @@ plugins for the pppd.
%patch17 %patch17
%patch18 %patch18
%patch19 -p1 %patch19 -p1
%if %_lib == lib64 %if %{_lib} == lib64
%patch21 %patch21
%endif %endif
%patch22 %patch22
@ -129,30 +151,32 @@ find -type f -name '*.orig' | xargs rm -f
sed -i '/#HAVE_LIBATM/s/#//' pppd/plugins/pppoatm/Makefile.linux sed -i '/#HAVE_LIBATM/s/#//' pppd/plugins/pppoatm/Makefile.linux
%build %build
# Remove local copy that is out of sync and use the one from linux-header export MY_CFLAGS="%{optflags} -fno-strict-aliasing -fPIC $SP"
rm -f include/linux/if_pppol2tp.h %configure
export MY_CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC $SP"
./configure --prefix=/usr
make %{?_smp_mflags} CHAPMS=y CBCP=y USE_CRYPT=y HAS_SHADOW=y USE_PAM=y FILTER=y HAVE_INET6=y HAVE_LOGWTMP=y make %{?_smp_mflags} CHAPMS=y CBCP=y USE_CRYPT=y HAS_SHADOW=y USE_PAM=y FILTER=y HAVE_INET6=y HAVE_LOGWTMP=y
%install %install
make install DESTDIR=%{buildroot}%_prefix make install DESTDIR=%{buildroot}%{_prefix}
install -d -m 750 %{buildroot}%{_sysconfdir}/ppp install -dm 750 %{buildroot}%{_sysconfdir}/ppp
install -m 644 %{S:5} %{buildroot}%{_sysconfdir}/ppp/options install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/ppp/options
install -m 644 %{S:6} %{buildroot}%{_sysconfdir}/ppp/filters install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/ppp/filters
install -m 600 %{S:2} %{buildroot}%{_sysconfdir}/ppp/pap-secrets install -m 600 %{SOURCE2} %{buildroot}%{_sysconfdir}/ppp/pap-secrets
install -m 600 %{S:3} %{buildroot}%{_sysconfdir}/ppp/chap-secrets install -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/ppp/chap-secrets
install -d 755 %{buildroot}%{_sysconfdir}/ppp/peers install -d 755 %{buildroot}%{_sysconfdir}/ppp/peers
install -m 644 %{S:8} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe install -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/ppp/peers/modem
install -m 644 %{S:9} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe-rp install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe
install -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe-rp
%ifnarch mips s390 s390x %ifnarch mips s390 s390x
install -m 644 %{S:10} %{buildroot}%{_sysconfdir}/ppp/peers/pppoatm install -m 644 %{SOURCE10} %{buildroot}%{_sysconfdir}/ppp/peers/pppoatm
%endif %endif
install -m 644 %{S:11} %{buildroot}%{_sysconfdir}/ppp/peers/ppp install -m 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/ppp/peers/ppp
install -m 644 %{S:12} %{buildroot}%{_sysconfdir}/ppp/peers/pptp install -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/ppp/peers/pptp
install -d 755 %{buildroot}%{_sysconfdir}/pam.d install -d 755 %{buildroot}%{_sysconfdir}/pam.d
install -m 644 %{S:1} %{buildroot}%{_sysconfdir}/pam.d/ppp install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/ppp
install -m 644 %{S:13} %{buildroot}%{_mandir}/man8/pppoe-discovery.8.gz install -m 644 %{SOURCE13} %{buildroot}%{_mandir}/man8/pppoe-discovery.8.gz
install -Dm 644 %{SOURCE14} %{buildroot}%{_sysconfdir}/ppp/chatscripts/modem.chat
install -Dm 644 %{SOURCE15} %{buildroot}%{_libexecdir}/systemd/system/modem@.service
install -Dm 644 %{SOURCE16} %{buildroot}%{_udevrulesdir}/90-modem.rules
%if 0%{?suse_version} < 1330 %if 0%{?suse_version} < 1330
%pre %pre
@ -160,17 +184,16 @@ getent group %{_group} >/dev/null || %{_sbindir}/groupadd -r %{_group}
%endif %endif
%files %files
%defattr (-, root, root)
%attr(750, root, root) %dir %{_sysconfdir}/ppp %attr(750, root, root) %dir %{_sysconfdir}/ppp
%dir %{_sysconfdir}/ppp/peers %dir %{_sysconfdir}/ppp/peers
%config(noreplace) %{_sysconfdir}/ppp/options %config(noreplace) %{_sysconfdir}/ppp/options
%config(noreplace) %{_sysconfdir}/ppp/filters %config(noreplace) %{_sysconfdir}/ppp/filters
%config(noreplace) %{_sysconfdir}/ppp/pap-secrets %config(noreplace) %{_sysconfdir}/ppp/pap-secrets
%config(noreplace) %{_sysconfdir}/ppp/chap-secrets %config(noreplace) %{_sysconfdir}/ppp/chap-secrets
%config(noreplace) %{_sysconfdir}/ppp/peers/* %config(noreplace) %{_sysconfdir}/ppp/peers/p*
%config(noreplace) %{_sysconfdir}/pam.d/ppp %config(noreplace) %{_sysconfdir}/pam.d/ppp
%doc FAQ README* SETUP scripts PLUGINS %doc FAQ README* SETUP scripts PLUGINS
%doc %{_mandir}/*/* %{_mandir}/man?/*.?%{ext_man}
%attr (-, root, dialout) %{_sbindir}/pppd %attr (-, root, dialout) %{_sbindir}/pppd
%{_sbindir}/chat %{_sbindir}/chat
%{_sbindir}/pppdump %{_sbindir}/pppdump
@ -181,7 +204,16 @@ getent group %{_group} >/dev/null || %{_sbindir}/groupadd -r %{_group}
%attr(0755,root,root) %{_libdir}/pppd/%{version}/*.so %attr(0755,root,root) %{_libdir}/pppd/%{version}/*.so
%files devel %files devel
%defattr (-, root, root)
%{_includedir}/pppd %{_includedir}/pppd
%files modem
%dir %{_sysconfdir}/ppp/peers
%config(noreplace) %{_sysconfdir}/ppp/peers/modem
%dir %{_sysconfdir}/ppp/chatscripts
%config(noreplace) %{_sysconfdir}/ppp/chatscripts/modem.chat
%dir %{_libexecdir}/systemd/system
%{_libexecdir}/systemd/system/modem@.service
%dir %{_udevrulesdir}
%{_udevrulesdir}/90-modem.rules
%changelog %changelog