Poprawki do pptpd

Stacho Pal stacho at venco.com.pl
Fri Jul 8 15:01:13 CEST 2016


Witam!
Poprawka w skrypcie init (-d to debug, a nie dameon)
i moja proba dodania pptpd.services.
Prosze o weryfikacje i ewentualne wrzucenie do gita.
------------------
pptpd.service:
==================
[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
================

pptpd.sysconfig:
===============
OPTIONS=
==============



diff --git a/pptpd.init b/pptpd.init
index 4f4f4e1..1aab83c 100644
--- a/pptpd.init
+++ b/pptpd.init
@@ -38,7 +38,7 @@ case "$1" in
  	if [ ! -f /var/lock/subsys/pptpd ]; then
  		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.spec b/pptpd.spec
index 2307f48..36a1213 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:	4
  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/
@@ -58,13 +60,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,11 +77,8 @@ 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
@@ -87,12 +88,15 @@ if [ "$1" = "0" ]; then
  	/sbin/chkconfig --del pptpd
  fi

+%systemd_preun %{name}.service

  %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}

---------------------------------
Dawno pine nie uzywalem. :)

-- 
pzdr
Stacho Pal


More information about the pld-devel-pl mailing list