rp-pppoe 3.8: More cleanups to the pppoe package:
authorJamie Lenehan <lenehan@twibble.org>
Thu, 7 Jun 2007 12:38:46 +0000 (12:38 +0000)
committerJamie Lenehan <lenehan@twibble.org>
Thu, 7 Jun 2007 12:38:46 +0000 (12:38 +0000)
* Seperate out the server, sniff and relay programs from the main
  package.
* Add an init script for the server.
* Add templates to the AC_DEFINE's in the configure script so the
  variables are correctly added to the header. Without this the
  variables don't get added and server and relay complain about not
  being able to be used on linux 2.0 system.

packages/rp-pppoe/rp-pppoe-3.8/configure_in_cross.patch
packages/rp-pppoe/rp-pppoe-3.8/pppoe-server.default [new file with mode: 0644]
packages/rp-pppoe/rp-pppoe-3.8/pppoe-server.init [new file with mode: 0755]
packages/rp-pppoe/rp-pppoe_3.8.bb

index 0543145..381a44d 100644 (file)
@@ -1,7 +1,7 @@
 Index: src/configure.in
 ===================================================================
---- rp-pppoe-3.8.org/src/configure.in  2006-04-03 00:29:42.000000000 +1000
-+++ rp-pppoe-3.8/src/configure.in      2007-06-07 20:00:48.000000000 +1000
+--- rp-pppoe-3.8.orig/src/configure.in 2006-04-03 00:29:42.000000000 +1000
++++ rp-pppoe-3.8/src/configure.in      2007-06-07 22:19:36.000000000 +1000
 @@ -5,6 +5,13 @@
  dnl pppd directory for kernel-mode PPPoE
  PPPD_DIR=ppp-2.4.1.pppoe2
@@ -16,6 +16,40 @@ Index: src/configure.in
  AC_CONFIG_HEADER(config.h)
  
  AC_PREFIX_DEFAULT(/usr)
+@@ -44,7 +51,7 @@
+ AC_MSG_RESULT($ac_cv_struct_sockaddr_ll)
+ if test "$ac_cv_struct_sockaddr_ll" = yes ; then
+-AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL)
++AC_DEFINE([HAVE_STRUCT_SOCKADDR_LL], [], [Have struct SOCKADDR_LL])
+ fi
+ dnl Check for N_HDLC line discipline
+@@ -55,7 +62,7 @@
+       ac_cv_n_hdlc=no)
+ AC_MSG_RESULT($ac_cv_n_hdlc)
+ if test "$ac_cv_n_hdlc" = yes ; then
+-AC_DEFINE(HAVE_N_HDLC)
++AC_DEFINE([HAVE_N_HDLC], [], [Have N_HDLC])
+ fi
+ AC_ARG_ENABLE(plugin, [  --enable-plugin=pppd_src_path   build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no)
+@@ -100,13 +107,13 @@
+ if test "$ac_cv_header_linux_if_pppox_h" = yes ; then
+       if test "$ac_cv_pluginpath" != no ; then
+               LINUX_KERNELMODE_PLUGIN=rp-pppoe.so
+-              AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE)
++              AC_DEFINE([HAVE_LINUX_KERNEL_PPPOE], [], [Have kernel PPPoE])
+               PPPD_INCDIR=$ac_cv_pluginpath
+       fi
+ fi
+ if test "$ac_cv_debugging" = "yes" ; then
+-   AC_DEFINE(DEBUGGING_ENABLED)
++   AC_DEFINE([DEBUGGING_ENABLED], [], [Debugging enabled])
+ fi
+ AC_SUBST(LINUX_KERNELMODE_PLUGIN)
 @@ -131,15 +138,8 @@
  AC_CHECK_SIZEOF(unsigned int)
  AC_CHECK_SIZEOF(unsigned long)
@@ -79,7 +113,7 @@ Index: src/configure.in
  AC_TRY_RUN([
  union foo {
      struct bar {
-@@ -245,6 +209,7 @@
+@@ -245,10 +209,11 @@
      }
  }], rpppoe_cv_pack_bitfields=normal, rpppoe_cv_pack_bitfields=rev,
  $ECHO "no defaults for cross-compiling"; exit 0)
@@ -87,3 +121,16 @@ Index: src/configure.in
  
  if test "$rpppoe_cv_pack_bitfields" = "rev" ; then
        AC_MSG_RESULT(reversed)
+-      AC_DEFINE(PACK_BITFIELDS_REVERSED)
++      AC_DEFINE([PACK_BITFIELDS_REVERSED], [], [Reversed bitfields])
+ else
+       AC_MSG_RESULT(normal)
+ fi
+@@ -312,6 +277,7 @@
+ AC_SUBST(RDYNAMIC)
+ AC_SUBST(LIBEVENT)
+ AC_SUBST(ECHO)
++AC_SUBST(HAVE_STRUCT_SOCKADDR_LL)
+ datadir_evaluated=`eval echo $datadir`
+ AC_SUBST(datadir_evaluated)
diff --git a/packages/rp-pppoe/rp-pppoe-3.8/pppoe-server.default b/packages/rp-pppoe/rp-pppoe-3.8/pppoe-server.default
new file mode 100644 (file)
index 0000000..996d57f
--- /dev/null
@@ -0,0 +1,22 @@
+# PPPoE Server options
+
+# Maximum segment size, not used for in kernel PPPoE
+#MSS=1412
+
+# Device(s) - Space seperated list of devices to listen on
+#DEVICES="eth1"
+
+# Local IP
+#LOCAL_IP=10.0.0.1
+
+# Starting remote IP
+#REMOTE_IP=10.67.15.1
+
+# Service name
+#SERVICE_NAME="acme"
+
+# Maximum number of sessions, default is 16
+#MAX_SESSIONS=64
+
+# Access concentrator name, default is the hostname
+#ACCESS_CONCENTRATOR_NAME="pppoe-rtr-1"
diff --git a/packages/rp-pppoe/rp-pppoe-3.8/pppoe-server.init b/packages/rp-pppoe/rp-pppoe-3.8/pppoe-server.init
new file mode 100755 (executable)
index 0000000..21afe0b
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh
+
+test -f /usr/sbin/pppoe-server || exit 0
+test -f /etc/default/pppoe-server && . /etc/default/pppoe-server
+
+case $1 in
+  start)
+    OPTIONS=""
+    if [ -n "$MSS" ]; then
+      OPTIONS="$OPTIONS -m $MSS"
+    fi
+    if [ -n "$DEVICES" ]; then
+      for i in $DEVICES; do
+        OPTIONS="$OPTIONS -I $i"
+      done
+    fi
+    if [ -n "$LOCAL_IP" ]; then
+      OPTIONS="$OPTIONS -L $LOCAL_IP"
+    fi
+    if [ -n "$REMOTE_IP" ]; then
+      OPTIONS="$OPTIONS -R $REMOTE_IP"
+    fi
+    if [ -n "$SERVICE_NAME" ]; then
+      OPTIONS="$OPTIONS -S $SERVICE_NAME"
+    fi
+    if [ -n "$MAX_SESSIONS" ]; then
+      OPTIONS="$OPTIONS -N $MAX_SESSIONS"
+    fi
+    if [ -n "$ACCESS_CONCENTRATOR_NAME" ]; then
+      OPTIONS="$OPTIONS -C $ACCESS_CONCENTRATOR_NAME"
+    fi
+    echo -n "Starting PPPoE server: pppoe-server"
+    start-stop-daemon --start --quiet --exec /usr/sbin/pppoe-server -- $OPTIONS
+    echo "."
+    ;;
+  stop)
+    echo -n "Stopping PPPoE server: pppoe-server"
+    start-stop-daemon --stop --quiet --exec /usr/sbin/pppoe-server -- $OPTIONS
+    echo "."
+    ;;
+  status)
+    pid=$(pidof pppoe-server)                    
+    if [ -n "$pid" ] ; then
+           echo "Running with pid $pid"
+    else
+           echo "Not running"
+    fi
+    ;;
+  restart|force-reload)
+    $0 stop
+    $0 start
+    ;;
+  *)
+    echo "Usage: /etc/init.d/pppoe-server {start|stop|restart|force-reload}"
+    exit 1
+    ;;
+esac
+
+exit 0
index ae3e52b..916201e 100644 (file)
@@ -2,17 +2,20 @@ DESCRIPTION = "A user-mode PPPoE client and server suite for Linux"
 HOMEPAGE = "http://www.roaringpenguin.com/en/penguin/openSourceProducts/rpPppoe"
 SECTION = "console/network"
 LICENSE = "GPLv2"
-RDEPENDS = "ppp"
-RRECOMMENDS = "ppp-oe"
-PR = "r1"
+RDEPENDS_${PN} = "ppp"
+RDEPENDS_${PN}-server = "ppp"
+RRECOMMENDS_${PN} = "ppp-oe"
+PR = "r2"
 
 SRC_URI = "http://www.roaringpenguin.com/files/download/${P}.tar.gz \
            file://configure_in_cross.patch;patch=1;pnum=2 \
-           file://pppoe-src-restrictions.patch;patch=1;pnum=2"
+           file://pppoe-src-restrictions.patch;patch=1;pnum=2 \
+           file://pppoe-server.default \
+           file://pppoe-server.init"
 
 S = "${WORKDIR}/${P}/src"
 
-inherit autotools
+inherit autotools update-rc.d
 
 do_install() {
         # Set timeout to 0. Fixes lots of reconnect issues
@@ -21,18 +24,38 @@ do_install() {
         sed -i -e 's,\(CONNECT_TIMEOUT=\)30,\10,g' \
                -e 's,\(LINUX_PLUGIN=\)/etc/ppp/plugins/rp-pppoe.so,\1rp-pppoe.so,g' \
                ${S}/../configs/pppoe.conf
+        # Install init script and default settings
+        install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d
+        install -m 0644 ${WORKDIR}/pppoe-server.default ${D}${sysconfdir}/default/pppoe-server
+        install -m 0755 ${WORKDIR}/pppoe-server.init ${D}${sysconfdir}/init.d/pppoe-server
         # Install
         oe_runmake -C ${S} RPM_INSTALL_ROOT=${D} docdir=${docdir} install
 }
 
-pkg_postinst() {
+# Insert server package before main package
+PACKAGES = "${PN}-dbg ${PN}-server ${PN}-relay ${PN}-sniff ${PN} ${PN}-doc"
+
+FILES_${PN}-server = "${sysconfdir}/default/pppoe-server \
+                      ${sysconfdir}/init.d/pppoe-server \
+                      ${sbindir}/pppoe-server \
+                      ${sysconfdir}/ppp/pppoe-server-options"
+FILES_${PN}-relay = "${sbindir}/pppoe-relay"
+FILES_${PN}-sniff = "${sbindir}/pppoe-sniff"
+
+pkg_postinst_${PN} () {
     if [ x"$D" != "x" ]; then
         exit 1
     fi
     chmod 4755 ${sbindir}/pppoe
 }
 
-CONFFILES_${PN} = "${sysconfdir}/ppp/pppoe-server-options \
-                   ${sysconfdir}/ppp/pppoe.conf \
+CONFFILES_${PN} = "${sysconfdir}/ppp/pppoe.conf \
                    ${sysconfdir}/ppp/firewall-standalone \
                    ${sysconfdir}/ppp/firewall-masq"
+CONFFILES_${PN}-server = "${sysconfdir}/ppp/pppoe-server-options \
+                          ${sysconfdir}/default/pppoe-server"
+
+INITSCRIPT_PACKAGES            = "${PN}-server"
+INITSCRIPT_NAME_${PN}-server   = "pppoe-server"
+INITSCRIPT_PARAMS_${PN}-server = "defaults 92 08"
+