close #9256
authorDonny Davies <woodchip@gentoo.org>
Fri, 25 Oct 2002 15:24:52 +0000 (15:24 +0000)
committerDonny Davies <woodchip@gentoo.org>
Fri, 25 Oct 2002 15:24:52 +0000 (15:24 +0000)
net-libs/openslp/ChangeLog
net-libs/openslp/files/slpd-init [new file with mode: 0644]
net-libs/openslp/openslp-1.0.8a.ebuild

index 2fc85a6150a3b2babdc35cbe4cc17677bbbc0042..e7cd0a3e6050cdf9e85615e3268e8ac7d97dbacf 100644 (file)
@@ -1,22 +1,22 @@
 # ChangeLog for net-libs/openslp
 # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL
-# $Header: /var/cvsroot/gentoo-x86/net-libs/openslp/ChangeLog,v 1.3 2002/10/19 21:07:54 cselkirk Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-libs/openslp/ChangeLog,v 1.4 2002/10/25 15:24:52 woodchip Exp $
+
+  25 Oct 2002; Donny Davies <woodchip@gentoo.org> slpd-init :
+  Created an initscript; as requested in #9256.
 
 *openslp-1.0.8a (27 Apr 2002)
 
   19 Oct 2002; Calum Selkirk <cselkirk@gentoo.org> openslp-1.0.8a.ebuild :
-
   Added ppc to KEYWORDS.
 
   27 Apr 2002; Seemant Kulleen <seemant@gentoo.org> openslp-1.0.8a.ebuild
   files/digest-openslp-1.0.8a :
-
   Thanks to lotia@umich.edu (ali asad lotia) in bug #1508 for the version bump.
 
 *openslp-1.0.4 (1 Feb 2002)
 
-  1 Feb 2002; G.Bevin <gbevin@gentoo.org> ChangeLog :
-  
+  1 Feb 2002; G.Bevin <gbevin@gentoo.org> ChangeLog :  
   Added initial ChangeLog which should be updated whenever the package is
   updated in any way. This changelog is targetted to users. This means that the
   comments should well explained and written in clean English. The details about
diff --git a/net-libs/openslp/files/slpd-init b/net-libs/openslp/files/slpd-init
new file mode 100644 (file)
index 0000000..fe07b62
--- /dev/null
@@ -0,0 +1,89 @@
+#!/sbin/runscript
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/openslp/files/slpd-init,v 1.1 2002/10/25 15:24:52 woodchip Exp $
+
+depend() {
+       need net
+}
+
+#
+# Does nothing if a route exists that supports multicast traffic.
+# If no routes supporting multicast traffic exists, the function
+# tries to add one.  A 0 is returned on success and a 1 on failure.
+# One parameter must be passed in.  This variable determins verbosity.
+# If parameter is non-zero debugging will appear.
+#
+multicast_route_set() {
+       PING_OPTIONS_1='-c1 -w1'
+       PING_OPTIONS_2='-c1 -i1'
+       MULTICAST_ADDRESS='239.255.255.253'
+       TMP_FILE=/tmp/route.check
+       PING_ERROR_NO_ROUTE='unreachable'
+
+       MSG_FAILED_TO_FIND='Failed to Detect Multicast Route'
+       MSG_SUCCESS_ON_FIND='Multicast Route Enabled'
+       MSG_ADDING_ROUTE='Attempting to Add Multicast Route ...'
+       MSG_FAILED_TO_ADD=' FAILED - Route NOT Added.'
+       MSG_SUCCES_ON_ADD=' SUCCESS - Route Added.'
+
+       CMD_GET_INTERFACE="netstat -i | awk 'BEGIN{}(NR>2)&&(!/^lo*/){print \$1}'"
+       CMD_ADD_ROUTE="route add -net 224.0.0.0 netmask 240.0.0.0"
+
+       ping $PING_OPTIONS_1 $MULTICAST_ADDRESS 2> $TMP_FILE 1> /dev/null
+       if [ $? = 2 ]; then
+               ping $PING_OPTIONS_2 $MULTICAST_ADDRESS 2> $TMP_FILE 1> /dev/null
+       fi
+
+       grep $PING_ERROR_NO_ROUTE $TMP_FILE > /dev/null 2>&1
+       err_unreachable_found=$?
+
+       #If errors, add route. Otherwise, do nothing
+       if [ -s $TMP_FILE ] && [ $err_unreachable_found = 0 ]; then 
+
+               if [ $1 != 0 ]; then
+                       echo $MSG_FAILED_TO_FIND 
+                       echo $MSG_ADDING_ROUTE 
+               fi
+
+               $CMD_ADD_ROUTE `eval $CMD_GET_INTERFACE` > /dev/null 2>&1
+               retval=$?
+               if [ $1 != 0 ]; then
+
+                       if [ $retval = 0 ]; then
+                               echo $MSG_SUCCES_ON_ADD
+                       else
+                               echo $MSG_FAILED_TO_ADD
+                       fi
+               fi
+       else
+               if [ $1 != 0 ]; then
+                       echo -n $MSG_SUCCESS_ON_FIND
+               fi
+               retval=0
+       fi
+
+       rm -f $TMP_FILE # Clean up
+       return $retval
+}
+
+checkconfig() {
+       multicast_route_set 0
+       if [ $? -ne 0 ]; then
+               eerror "No route available for multicast traffic!"
+               return 1
+       fi
+}
+
+start() {
+       checkconfig || return 1
+       ebegin "Starting slpd"
+       start-stop-daemon --start --quiet --background --exec /usr/sbin/slpd
+       eend $?
+}
+
+stop() {
+       ebegin "Stopping slpd"
+       start-stop-daemon --stop --quiet --pidfile /var/run/slpd.pid
+       eend $?
+}
index ace50ce2a6af5c86bd0e74b3b55c3d37375be05b..e2827cc1aabf9cca030f201f8b00cc5360b3073f 100644 (file)
@@ -1,30 +1,29 @@
 # Copyright 1999-2002 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-libs/openslp/openslp-1.0.8a.ebuild,v 1.7 2002/10/19 21:07:54 cselkirk Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-libs/openslp/openslp-1.0.8a.ebuild,v 1.8 2002/10/25 15:24:52 woodchip Exp $
 
-S=${WORKDIR}/${P}
 DESCRIPTION="An open-source implementation of Service Location Protocol"
-SRC_URI="mirror://sourceforge/openslp/${P}.tar.gz"
 HOMEPAGE="http://www.openslp.org"
 
+S=${WORKDIR}/${P}
+SRC_URI="mirror://sourceforge/openslp/${P}.tar.gz"
+
+KEYWORDS="x86 sparc sparc64 ppc"
 DEPEND="virtual/glibc"
 
 SLOT="0"
 LICENSE="as-is"
-KEYWORDS="x86 sparc sparc64 ppc"
 
 src_compile() {
-       
        econf || die
-    make || die
-
+       make || die
 }
 
-src_install () {
-
-    einstall || die
-    dodoc AUTHORS FAQ COPYING ChangeLog NEWS README* THANKS 
-    rm -rf ${D}/usr/doc
-    dohtml -r .
-
+src_install() {
+       einstall || die
+       dodoc AUTHORS FAQ COPYING ChangeLog NEWS README* THANKS
+       rm -rf ${D}/usr/doc
+       dohtml -r .
+       exeinto /etc/init.d
+       newexe ${FILESDIR}/slpd-init slpd
 }