[rp-pppoe] bz#697664, native systemd file

Than Ngo than at fedoraproject.org
Tue Jul 5 11:22:16 UTC 2011


commit 64d2a1eed101f1b869feeae385260f66bd74cf9e
Author: Than Ngo <than at redhat.com>
Date:   Tue Jul 5 13:22:29 2011 +0200

    bz#697664, native systemd file

 rp-pppoe.spec |   97 +++++++++++++++++----------------------------------------
 1 files changed, 29 insertions(+), 68 deletions(-)
---
diff --git a/rp-pppoe.spec b/rp-pppoe.spec
index df8e1f9..a205ba2 100644
--- a/rp-pppoe.spec
+++ b/rp-pppoe.spec
@@ -1,7 +1,7 @@
 Summary: A PPP over Ethernet client (for xDSL support).
 Name: rp-pppoe
 Version: 3.10
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPLv2+
 Group: System Environment/Daemons
 Url: http://www.roaringpenguin.com/pppoe/
@@ -11,18 +11,23 @@ Source2: pppoe-setup
 Source3: pppoe-start
 Source4: pppoe-status
 Source5: pppoe-stop
-Source6: pppoe-server.init
+Source6: pppoe-server.service
 
 Patch0: rp-pppoe-3.8-redhat.patch
 
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-Requires(post): chkconfig initscripts fileutils
+Requires(post): initscripts fileutils
 Requires(postun): chkconfig initscripts fileutils
 Requires: ppp >= 2.4.2
 Requires: initscripts >= 5.92
 Requires: iproute >= 2.6
 Requires: mktemp
+Requires: systemd-units >= 13
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
 
 BuildRequires: libtool
 BuildRequires: autoconf
@@ -53,7 +58,6 @@ make
 rm -rf %{buildroot}
 
 mkdir -p %{buildroot}/sbin
-mkdir -p %{buildroot}%{_sysconfdir}/etc/rc.d/init.d
 
 make -C src install DESTDIR=%{buildroot}
 
@@ -64,7 +68,7 @@ install -m 0755 %{SOURCE2} %{buildroot}/sbin
 install -m 0755 %{SOURCE3} %{buildroot}/sbin
 install -m 0755 %{SOURCE4} %{buildroot}/sbin
 install -m 0755 %{SOURCE5} %{buildroot}/sbin
-install -m 0755 %{SOURCE6} %{buildroot}%{_sysconfdir}/rc.d/init.d/pppoe-server
+install -m 0755 %{SOURCE6} %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/pppoe-server.service
 
 pushd %{buildroot}%{_sbindir}
 ln -s ../../sbin/* .
@@ -80,76 +84,30 @@ rm -rf %{buildroot}/etc/ppp/pppoe.conf \
 %clean
 rm -rf %{buildroot}
 
+if [ $1 -eq 1 ] ; then
+   # Initial installation
+   /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
 %preun
 if [ "$1" = "0" ]; then
-   /sbin/service pppoe-server stop > /dev/null 2>&1
-   /sbin/chkconfig --del pppoe-server
+   # Package removal, not upgrade
+   /bin/systemctl disable pppoe-server.service > /dev/null 2>&1 || :
+   /bin/systemctl stop pppoe-server.service > /dev/null 2>&1 || :
 fi
-exit 0
 
 %postun
-if [ "$1" -ge "1" ]; then
-   /sbin/service pppoe-server condrestart > /dev/null 2>&1
-fi
-exit 0
-
-
-%triggerpostun -- rp-pppoe < 3.2-1
-if [ -f /etc/rc.d/init.d/pppoe ]; then
-   rm -f /etc/rc.d/init.d/pppoe
-fi
-exit 0
-
-%triggerin -- rp-pppoe < 3.2-1
-/sbin/service pppoe stop >/dev/null 2>&1 || true
-/sbin/chkconfig --del pppoe >/dev/null 2>&1 || true
-
-BOOT=""
-DEVPATH=/etc/sysconfig/networking/devices
-NETDEV=ifcfg-xDSL
-
-[ -f /etc/ppp/pppoe.conf ] && CONFIG=/etc/ppp/pppoe.conf . /etc/ppp/pppoe.conf >/dev/null 2>&1
-[ -n "$BOOT" ] || exit 0
-[ -n "$DEVICE" ] || exit 0
-[ -d $DEVPATH ] || mkdir -p $DEVPATH
-
-touch $DEVPATH/$NETDEV && chmod 700 $DEVPATH/$NETDEV
-echo "DEVICE=$DEVICE" >$DEVPATH/$NETDEV
-
-[ -n "$BOOT" ] || BOOT=no
-echo "ONBOOT=$BOOT" >>$DEVPATH/$NETDEV 
-
-if [ "$USEPEERDNS" = "yes" ]; then
-	echo "PEERDNS=yes" >>$DEVPATH/$NETDEV 
-else
-	echo "PEERDNS=no" >>$DEVPATH/$NETDEV 
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart pppoe-server.service >/dev/null 2>&1 || :
 fi
 
-echo "DEFROUTE=yes" >>$DEVPATH/$NETDEV 
-echo "TYPE=xDSL" >>$DEVPATH/$NETDEV 
-echo "ETH=$ETH" >>$DEVPATH/$NETDEV 
-echo "USER=$USER" >>$DEVPATH/$NETDEV 
-echo "PASS=$PASS" >>$DEVPATH/$NETDEV 
-echo "DEMAND=$DEMAND" >>$DEVPATH/$NETDEV 
-echo "CONNECT_TIMEOUT=$CONNECT_TIMEOUT" >>$DEVPATH/$NETDEV 
-echo "CONNECT_POLL=$CONNECT_POLL" >>$DEVPATH/$NETDEV 
-echo "PING=\".\"" >>$DEVPATH/$NETDEV 
-echo "SYNCHRONOUS=$SYNCHRONOUS" >>$DEVPATH/$NETDEV
-echo "CLAMPMSS=$CLAMPMSS" >>$DEVPATH/$NETDEV
-echo "LCP_INTERVAL=$LCP_INTERVAL" >>$DEVPATH/$NETDEV
-echo "LCP_FAILURE=$LCP_FAILURE" >>$DEVPATH/$NETDEV
-echo "PPPOE_TIMEOUT=$PPPOE_TIMEOUT" >>$DEVPATH/$NETDEV
-echo "FIREWALL=$FIREWALL" >>$DEVPATH/$NETDEV
-echo "PPPOE_EXTRA=$PPPOE_EXTRA" >>$DEVPATH/$NETDEV
-echo "PIDFILE=/var/run/pppoe-adsl.pid" >>$DEVPATH/$NETDEV
-echo "SERVICENAME=$SERVICENAME" >>$DEVPATH/$NETDEV
-echo "ACNAME=$ACNAME" >>$DEVPATH/$NETDEV
-
-pushd /etc/sysconfig/network-scripts
-ln -f ../networking/devices/$NETDEV ifcfg-$DEVICE
-popd
+triggerun -- %{name} < 3.10-9
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del pppoe-server >/dev/null 2>&1 || :
+/bin/systemctl try-restart pppoe-server.service >/dev/null 2>&1 || :
 
-exit 0
 
 %files
 %defattr(-,root,root)
@@ -158,12 +116,15 @@ exit 0
 %doc configs
 %config(noreplace) %{_sysconfdir}/ppp/pppoe-server-options
 %config(noreplace) %{_sysconfdir}/ppp/firewall*
-%config(noreplace) %{_sysconfdir}/rc.d/init.d/*
+%{_unitdir}/pppoe-server.service
 /sbin/*
 %{_sbindir}/*
 %{_mandir}/man?/*
 
 %changelog
+* Tue Jul 05 2011 Than Ngo <than at redhat.com> - 3.10-9
+- bz#697664, native systemd file
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.10-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list