From d4a837a1b868ce5811343c39c845231d8a05d31f0041bad20ae5861f879cb651 Mon Sep 17 00:00:00 2001 From: OBS User mrdocs Date: Sat, 2 Dec 2017 04:17:03 +0000 Subject: [PATCH] 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 --- modem-peers | 18 ++++++++++ modem.chat | 19 ++++++++++ modem.rules | 1 + modem@.service | 13 +++++++ ppp.changes | 6 ++++ ppp.spec | 98 +++++++++++++++++++++++++++++++++----------------- 6 files changed, 122 insertions(+), 33 deletions(-) create mode 100644 modem-peers create mode 100644 modem.chat create mode 100644 modem.rules create mode 100644 modem@.service diff --git a/modem-peers b/modem-peers new file mode 100644 index 0000000..9233655 --- /dev/null +++ b/modem-peers @@ -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" diff --git a/modem.chat b/modem.chat new file mode 100644 index 0000000..a71e22f --- /dev/null +++ b/modem.chat @@ -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 diff --git a/modem.rules b/modem.rules new file mode 100644 index 0000000..dcf1a90 --- /dev/null +++ b/modem.rules @@ -0,0 +1 @@ +KERNEL=="ttyACM[0-9]*", TAG+="systemd", ENV{SYSTEMD_WANTS}="modem@%n.service" diff --git a/modem@.service b/modem@.service new file mode 100644 index 0000000..1e1cbfc --- /dev/null +++ b/modem@.service @@ -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 diff --git a/ppp.changes b/ppp.changes index bd784d6..d5b7545 100644 --- a/ppp.changes +++ b/ppp.changes @@ -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 diff --git a/ppp.spec b/ppp.spec index f5c5a73..71ecf43 100644 --- a/ppp.spec +++ b/ppp.spec @@ -12,22 +12,18 @@ # 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/ +# Please submit bugfixes or comments via https://bugs.opensuse.org # %define _group dialout Name: ppp -BuildRequires: libpcap-devel -BuildRequires: linux-atm-devel -BuildRequires: pam-devel -Url: http://ppp.samba.org/ Version: 2.4.7 Release: 0 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 -BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: ftp://ftp.samba.org/pub/ppp/ppp-%{version}.tar.gz +URL: https://ppp.samba.org +Source0: https://download.samba.org/pub/%{name}/%{name}-%{version}.tar.gz # config for pam Source1: ppp.pamd # templates for secrets @@ -37,12 +33,17 @@ Source3: chap-secrets.template Source5: options Source6: filters # several peers file +Source7: modem-peers Source8: pppoe-peers Source9: pppoe-rp-peers Source10: pppoatm-peers Source11: ppp-peers Source12: pptp-peers Source13: pppoe-discovery.8.gz +# modem files +Source14: modem.chat +Source15: modem@.service +Source16: modem.rules # Makefile changes Patch0: ppp-2.4.6-make.diff # replacedefaultroute option @@ -72,6 +73,9 @@ Patch23: ppp-send-padt.patch # PATCH-FIX-UPSTREAM -- Patch for CVE-2015-3310 Patch24: ppp-CVE-2015-3310.patch Patch25: fix-header-conflict.patch +BuildRequires: libpcap-devel +BuildRequires: linux-atm-devel +BuildRequires: pam-devel %if 0%{?suse_version} >= 1330 Requires: group(%{_group}) Requires(pre): group(%{_group}) @@ -90,12 +94,30 @@ interface and performing the PPP negotiations. %package devel Summary: Header Files Required for Developing Plugins for pppd Group: Development/Libraries/C and C++ -Requires: ppp = %version +Requires: ppp = %{version} %description devel The package ppp-devel contains C header files required for developing 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 %setup -q %patch0 @@ -113,7 +135,7 @@ plugins for the pppd. %patch17 %patch18 %patch19 -p1 -%if %_lib == lib64 +%if %{_lib} == lib64 %patch21 %endif %patch22 @@ -129,30 +151,32 @@ find -type f -name '*.orig' | xargs rm -f sed -i '/#HAVE_LIBATM/s/#//' pppd/plugins/pppoatm/Makefile.linux %build -# Remove local copy that is out of sync and use the one from linux-header -rm -f include/linux/if_pppol2tp.h -export MY_CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC $SP" -./configure --prefix=/usr +export MY_CFLAGS="%{optflags} -fno-strict-aliasing -fPIC $SP" +%configure 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 -make install DESTDIR=%{buildroot}%_prefix -install -d -m 750 %{buildroot}%{_sysconfdir}/ppp -install -m 644 %{S:5} %{buildroot}%{_sysconfdir}/ppp/options -install -m 644 %{S:6} %{buildroot}%{_sysconfdir}/ppp/filters -install -m 600 %{S:2} %{buildroot}%{_sysconfdir}/ppp/pap-secrets -install -m 600 %{S:3} %{buildroot}%{_sysconfdir}/ppp/chap-secrets -install -d 755 %{buildroot}%{_sysconfdir}/ppp/peers -install -m 644 %{S:8} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe -install -m 644 %{S:9} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe-rp +make install DESTDIR=%{buildroot}%{_prefix} +install -dm 750 %{buildroot}%{_sysconfdir}/ppp +install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/ppp/options +install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/ppp/filters +install -m 600 %{SOURCE2} %{buildroot}%{_sysconfdir}/ppp/pap-secrets +install -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/ppp/chap-secrets +install -d 755 %{buildroot}%{_sysconfdir}/ppp/peers +install -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/ppp/peers/modem +install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe +install -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/ppp/peers/pppoe-rp %ifnarch mips s390 s390x -install -m 644 %{S:10} %{buildroot}%{_sysconfdir}/ppp/peers/pppoatm +install -m 644 %{SOURCE10} %{buildroot}%{_sysconfdir}/ppp/peers/pppoatm %endif -install -m 644 %{S:11} %{buildroot}%{_sysconfdir}/ppp/peers/ppp -install -m 644 %{S:12} %{buildroot}%{_sysconfdir}/ppp/peers/pptp -install -d 755 %{buildroot}%{_sysconfdir}/pam.d -install -m 644 %{S:1} %{buildroot}%{_sysconfdir}/pam.d/ppp -install -m 644 %{S:13} %{buildroot}%{_mandir}/man8/pppoe-discovery.8.gz +install -m 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/ppp/peers/ppp +install -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/ppp/peers/pptp +install -d 755 %{buildroot}%{_sysconfdir}/pam.d +install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/ppp +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 %pre @@ -160,17 +184,16 @@ getent group %{_group} >/dev/null || %{_sbindir}/groupadd -r %{_group} %endif %files -%defattr (-, root, root) %attr(750, root, root) %dir %{_sysconfdir}/ppp %dir %{_sysconfdir}/ppp/peers %config(noreplace) %{_sysconfdir}/ppp/options %config(noreplace) %{_sysconfdir}/ppp/filters %config(noreplace) %{_sysconfdir}/ppp/pap-secrets %config(noreplace) %{_sysconfdir}/ppp/chap-secrets -%config(noreplace) %{_sysconfdir}/ppp/peers/* +%config(noreplace) %{_sysconfdir}/ppp/peers/p* %config(noreplace) %{_sysconfdir}/pam.d/ppp %doc FAQ README* SETUP scripts PLUGINS -%doc %{_mandir}/*/* +%{_mandir}/man?/*.?%{ext_man} %attr (-, root, dialout) %{_sbindir}/pppd %{_sbindir}/chat %{_sbindir}/pppdump @@ -181,7 +204,16 @@ getent group %{_group} >/dev/null || %{_sbindir}/groupadd -r %{_group} %attr(0755,root,root) %{_libdir}/pppd/%{version}/*.so %files devel -%defattr (-, root, root) %{_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