[rp-pppoe] Cleanup and modernise spec, Build as a hardened build as per packaging guidelines, nify pppoe* scrip

Peter Robinson pbrobinson at fedoraproject.org
Tue Sep 2 09:21:29 UTC 2014


commit 1c21fbb92b8406a208b07243e3704244cac3e444
Author: Peter Robinson <pbrobinson at gmail.com>
Date:   Tue Sep 2 10:21:13 2014 +0100

    Cleanup and modernise spec, Build as a hardened build as per packaging guidelines, nify pppoe* scripts on ip use to enable to drop net-tools dependency

 pppoe-connect |   10 +++++-----
 pppoe-setup   |    6 +++---
 pppoe-start   |   14 +++++++-------
 pppoe-status  |    7 ++++---
 pppoe-stop    |    3 ++-
 rp-pppoe.spec |   47 +++++++++++++++++++++--------------------------
 6 files changed, 42 insertions(+), 45 deletions(-)
---
diff --git a/pppoe-connect b/pppoe-connect
index e3d98ad..0e40ad6 100755
--- a/pppoe-connect
+++ b/pppoe-connect
@@ -26,14 +26,14 @@ exec_prefix=/usr
 localstatedir=/var
 
 # Paths to programs
-IP=/sbin/ip
+IP=/usr/sbin/ip
 PPPD=/usr/sbin/pppd
 SETSID=/usr/bin/setsid
 PPPOE=/usr/sbin/pppoe
 BR2684CTL=/usr/sbin/br2684ctl
 LOGGER="/usr/bin/logger -t `basename $0`"
 NETWORKDIR=/etc/sysconfig/network-scripts
-LS=/bin/ls
+LS=/usr/bin/ls
 
 get_device() {
     if [ ! -d $NETWORKDIR ] ; then
@@ -282,7 +282,7 @@ if test "$DEFROUTE" != "no" ; then
     DEFRT=$(ip route list match 0/0)
     [ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes
     echo "$DEFRT" | while read spec; do
-        ip route del $spec;
+        $IP route del $spec;
     done
 else
     DEFAULTROUTE=""
@@ -356,13 +356,13 @@ while [ true ] ; do
         DEFRT=$(ip route list match 0/0)
         [ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes
         echo "$DEFRT" | while read spec; do
-            ip route del $spec;
+            $IP route del $spec;
         done
     fi
 
     if test "$BR2684DEV" != ""; then
         $BR2684CTL -b -c $BR2684DEV -a $VPI.$VCI
-        ip link set $ETH up
+        $IP link set $ETH up
     fi
     if test "$OVERRIDE_PPPD_COMMAND" != "" ; then
        $SETSID $OVERRIDE_PPPD_COMMAND &
diff --git a/pppoe-setup b/pppoe-setup
index ee7a48f..44c9ffa 100755
--- a/pppoe-setup
+++ b/pppoe-setup
@@ -11,11 +11,11 @@
 #***********************************************************************
 
 # Paths to programs and config files
-IP=/sbin/ip
+IP=/usr/sbin/ip
 PPPD=/usr/sbin/pppd
 PPPOE=/sbin/pppoe
-ECHO=/bin/echo
-LS=/bin/ls
+ECHO=/usr/bin/echo
+LS=/usr/bin/ls
 ID=/usr/bin/id
 NETWORKDIR=/etc/sysconfig/network-scripts
 PAPFILE=/etc/ppp/chap-secrets
diff --git a/pppoe-start b/pppoe-start
index ef69a33..b688170 100755
--- a/pppoe-start
+++ b/pppoe-start
@@ -25,10 +25,10 @@ prefix=/usr
 exec_prefix=/usr
 
 # Paths to programs
-CONNECT=/sbin/pppoe-connect
-ECHO=/bin/echo
-IP=/sbin/ip
-LS=/bin/ls
+CONNECT=/usr/sbin/pppoe-connect
+ECHO=/usr/bin/echo
+IP=/usr/sbin/ip
+LS=/usr/bin/ls
 NETWORKDIR=/etc/sysconfig/network-scripts
 
 get_device() {
@@ -104,8 +104,8 @@ if [ "$DEBUG" = "1" ] ; then
     $ECHO "* have defined a default route and gateway, and pppd will" >> $DEBUG
     $ECHO "* not create a default route using your ISP.  Try getting" >> $DEBUG
     $ECHO "* rid of this route." >> $DEBUG
-    $ECHO "Output of netstat -n -r" >> $DEBUG
-    netstat -n -r >> $DEBUG
+    $ECHO "Output of ip route" >> $DEBUG
+    $IP route >> $DEBUG
     $ECHO "---------------------------------------------" >> $DEBUG
     $ECHO "Contents of /etc/resolv.conf" >> $DEBUG
     $ECHO "* The following section lists DNS setup." >> $DEBUG
@@ -219,7 +219,7 @@ rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start"
 # add old default gw back
 if [ -s /etc/default-routes ] ; then
     while read spec; do
-        /sbin/ip route add $spec
+        $IP route add $spec
     done < /etc/default-routes
     rm -f /etc/default-routes
 fi
diff --git a/pppoe-status b/pppoe-status
index 3b3d243..d3e03c9 100755
--- a/pppoe-status
+++ b/pppoe-status
@@ -20,7 +20,8 @@
 #***********************************************************************
 
 # Defaults
-LS=/bin/ls
+LS=/usr/bin/ls
+IP=/usr/sbin/ip
 NETWORKDIR=/etc/sysconfig/network-scripts
 
 get_device() {
@@ -87,13 +88,13 @@ for i in /etc/ppp/ppp*.pid /var/run/ppp*.pid ; do
 	PID=`cat $i`
 	if [ "$PID" = "$PPPD_PID" ] ; then
 	    IF=`basename $i .pid`
-	    netstat -rn | grep " ${IF}\$" > /dev/null
+	    $IP route | grep " ${IF}\$" > /dev/null
 	    if [ "$?" != "0" ] ; then
 		echo "pppoe-status: Link is attached to $IF, but $IF is down"
 		exit 1
 	    fi
 	    echo "pppoe-status: Link is up and running on interface $IF"
-	    /sbin/ip addr show $IF
+	    $IP addr show $IF
 	    exit 0
 	fi
     fi
diff --git a/pppoe-stop b/pppoe-stop
index a3c9f84..65776df 100755
--- a/pppoe-stop
+++ b/pppoe-stop
@@ -22,6 +22,7 @@
 
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
+IP=/usr/sbin/ip
 LS=/bin/ls
 NETWORKDIR=/etc/sysconfig/network-scripts
 
@@ -134,7 +135,7 @@ fi
 # add old default gw back
 if [ -s /etc/default-routes ] ; then
     while read spec; do
-        /sbin/ip route add $spec
+        $IP route add $spec
     done < /etc/default-routes
     rm -f /etc/default-routes
 fi
diff --git a/rp-pppoe.spec b/rp-pppoe.spec
index 1ac30d6..dbb2e08 100644
--- a/rp-pppoe.spec
+++ b/rp-pppoe.spec
@@ -1,10 +1,13 @@
-Summary: A PPP over Ethernet client (for xDSL support).
+%global _hardened_build 1
+
 Name: rp-pppoe
 Version: 3.11
-Release: 10%{?dist}
+Release: 11%{?dist}
+Summary: A PPP over Ethernet client (for xDSL support).
 License: GPLv2+
 Group: System Environment/Daemons
 Url: http://www.roaringpenguin.com/pppoe/
+
 Source: http://www.roaringpenguin.com/files/download/rp-pppoe-%{version}.tar.gz
 Source1: pppoe-connect
 Source2: pppoe-setup
@@ -16,26 +19,20 @@ Source6: pppoe-server.service
 Patch0: rp-pppoe-3.8-redhat.patch
 Patch1: rp-pppoe-3.11-ip-allocation.patch
 
-Requires(post): initscripts fileutils
-Requires(postun): chkconfig initscripts fileutils
-Requires: ppp >= 2.4.2
-Requires: initscripts >= 5.92
-Requires: iproute >= 2.6
-Requires: coreutils
-Requires: systemd-units >= 39-2
-Requires: net-tools
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
-Requires(post): systemd-sysv
-Conflicts: filesystem < 3
-
 BuildRequires: libtool
 BuildRequires: autoconf
 BuildRequires: automake
 BuildRequires: coreutils
-BuildRequires: ppp
-BuildRequires: systemd-units >= 39-2
+BuildRequires: ppp-devel
+BuildRequires: systemd
+
+Requires: ppp >= 2.4.6
+Requires: iproute >= 2.6
+Requires: coreutils
+Requires: systemd
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 
 ExcludeArch: s390 s390x
 
@@ -61,7 +58,7 @@ sed -i -e 's,^docdir=.*$,docdir=@docdir@,' src/Makefile.in
 %build
 cd src
 autoconf
-export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fno-strict-aliasing"
+export CFLAGS="%{optflags} -D_GNU_SOURCE -fno-strict-aliasing"
 %configure --docdir=%{_pkgdocdir}
 make
 
@@ -92,13 +89,6 @@ rm -rf %{buildroot}/etc/ppp/pppoe.conf \
 
 %postun
 %systemd_postun_with_restart pppoe-server.service
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-
-%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 || :
-
 
 %files
 %doc scripts/pppoe-connect scripts/pppoe-setup scripts/pppoe-init
@@ -111,6 +101,11 @@ rm -rf %{buildroot}/etc/ppp/pppoe.conf \
 %{_mandir}/man?/*
 
 %changelog
+* Tue Sep  2 2014 Peter Robinson <pbrobinson at fedoraproject.org> 3.11-11
+- Cleanup and modernise spec
+- Build as a hardened build as per packaging guidelines
+- Unify pppoe* scripts on ip use to enable to drop net-tools dependency
+
 * Thu Aug 21 2014 Than Ngo <than at redhat.com> - 3.11-10
 - bz#850300, new systemd-rpm macros in rp-pppoe spec file
 


More information about the scm-commits mailing list