commit b94d454bde65e2cfbc8aedf7bab1e3a1b4173965
Author: Jan Rękorajski <[email protected]>
Date:   Sun Jul 31 17:22:41 2016 +0200

    - added sysconfig and systemd service (by Stacho Pal)
    - fixed init script (-d means debug) (by Stacho Pal)

 pptpd.init      |  1 +
 pptpd.service   | 11 +++++++++++
 pptpd.spec      | 27 +++++++++++++++++----------
 pptpd.sysconfig |  1 +
 4 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/pptpd.spec b/pptpd.spec
index 2307f48..6fb6a63 100644
--- a/pptpd.spec
+++ b/pptpd.spec
@@ -2,12 +2,14 @@ Summary:      Serves out PPTP connections
 Summary(pl.UTF-8):     Serwer połączeń PPTP
 Name:          pptpd
 Version:       1.4.0
-Release:       1
+Release:       2
 License:       GPL
 Group:         Networking/Daemons
 Source0:       
http://downloads.sourceforge.net/poptop/%{name}-%{version}.tar.gz
 # Source0-md5: 36f9f45c6ffa92bc3b6e24ae2d053505
 Source1:       %{name}.init
+Source2:       %{name}.service
+Source3:       %{name}.sysconfig
 Patch0:                %{name}-install.patch
 Patch1:                %{name}-lib64.patch
 #URL:          http://www.poptop.org/
@@ -16,9 +18,12 @@ BuildRequires:       autoconf
 BuildRequires: automake
 BuildRequires: ppp-plugin-devel
 BuildRequires: sed >= 4.0
+BuildRequires: rpmbuild(macros) >= 1.647
 Requires(post,preun):  /sbin/chkconfig
+Requires(post,preun,postun):   systemd-units >= 38
 Requires:      ppp >= 2.4.3
 Requires:      rc-scripts
+Requires:      systemd-units >= 0.38
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -58,13 +63,15 @@ sed -i -e "s#/lib#/%{_lib}#g#" plugins/Makefile
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/rc.d/init.d}
+install -d $RPM_BUILD_ROOT{%{systemdunitdir},/etc/{rc.d/init.d,sysconfig}}
 
 %{__make} install \
         DESTDIR=$RPM_BUILD_ROOT
 
 cp -p samples/pptpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/pptpd.conf
 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/pptpd.service
+cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
 
 rm -rf html/CVS samples/CVS
 
@@ -73,26 +80,26 @@ rm -rf $RPM_BUILD_ROOT
 
 %post
 /sbin/chkconfig --add pptpd
-if [ -f /var/lock/subsys/pptpd ]; then
-       /etc/rc.d/init.d/pptpd restart 1>&2
-else
-       echo "Type \"/etc/rc.d/init.d/pptpd start\" to start pptpd." 1>&2
-fi
+%service %{name} restart
+%systemd_post %{name}.service
 
 %preun
 if [ "$1" = "0" ]; then
-       if [ -f /var/lock/subsys/pptpd ]; then
-               /etc/rc.d/init.d/pptpd stop 1>&2
-       fi
+       %service -q %{name} stop
        /sbin/chkconfig --del pptpd
 fi
+%systemd_preun %{name}.service
 
+%postun
+%systemd_reload
 
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS README TODO samples/*
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pptpd.conf
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
 %attr(754,root,root) /etc/rc.d/init.d/%{name}
+%{systemdunitdir}/%{name}.service
 %attr(755,root,root) %{_sbindir}/*
 %{_mandir}/man?/*
 %{_libdir}/%{name}
diff --git a/pptpd.init b/pptpd.init
index 4f4f4e1..dce7c7c 100644
--- a/pptpd.init
+++ b/pptpd.init
@@ -39,6 +39,7 @@ case "$1" in
                is_no "$RC_LOGGING" && closefds=--closefds
                msg_starting pptpd
                daemon $closefds /usr/sbin/pptpd -d
+               daemon $closefds /usr/sbin/pptpd $OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pptpd
        else
diff --git a/pptpd.service b/pptpd.service
new file mode 100644
index 0000000..5b23f29
--- /dev/null
+++ b/pptpd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=PoPToP Point to Point Tunneling Server
+After=network.target
+
+[Service]
+EnvironmentFile=/etc/sysconfig/pptpd
+ExecStart=/usr/sbin/pptpd -f $OPTIONS
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target
diff --git a/pptpd.sysconfig b/pptpd.sysconfig
new file mode 100644
index 0000000..f0d2bfb
--- /dev/null
+++ b/pptpd.sysconfig
@@ -0,0 +1 @@
+OPTIONS=
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pptpd.git/commitdiff/b94d454bde65e2cfbc8aedf7bab1e3a1b4173965

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to