From e872b1e26ec4fb3cd50cbdf385b21b6425c77538 Mon Sep 17 00:00:00 2001 From: cvsextras Date: Mon, 8 Nov 2004 04:56:22 +0000 Subject: [PATCH] auto-import changelog data from openslp-1.2.0-0.fdr.4.1.src.rpm 1.2.0-0.fdr.4 - BR: flex 1.2.0-0.fdr.3 - BR: bison 1.2.0-0.fdr.2 - fix/add condrestart to init script 1.2.0-0.fdr.1 - 1.2.0 - use -pie - don't use Requires(post,postun) 1.0.11-0.fdr.7 - fix for Fedora Core - fix description (main package does *not* include daemon and header files). --- .cvsignore | 2 +- openslp-1.2.0-optflags.patch | 11 ++ openslp.init | 86 ------------ openslp.spec | 96 ++++++++----- slpd.init | 256 +++++++++++++++++++++++++++++++++++ sources | 2 +- 6 files changed, 332 insertions(+), 121 deletions(-) create mode 100644 openslp-1.2.0-optflags.patch delete mode 100755 openslp.init create mode 100644 slpd.init diff --git a/.cvsignore b/.cvsignore index 17a3626..35348f3 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -openslp-1.0.11.tar.gz +openslp-1.2.0.tar.gz diff --git a/openslp-1.2.0-optflags.patch b/openslp-1.2.0-optflags.patch new file mode 100644 index 0000000..6899f88 --- /dev/null +++ b/openslp-1.2.0-optflags.patch @@ -0,0 +1,11 @@ +--- openslp-1.2.0/configure.in.optflags 2004-07-15 09:03:43.000000000 -0500 ++++ openslp-1.2.0/configure.in 2004-02-04 14:07:33.000000000 -0600 +@@ -126,7 +126,7 @@ + CFLAGS="$CFLAGS -Werror" + fi + if test X"$debug" = X"no"; then +- OPTFLAGS="-O3" ++ OPTFLAGS="-O3 $RPM_OPT_FLAGS " + fi + + elif $CC -V 2>&1 | grep "WorkShop Compilers"; then diff --git a/openslp.init b/openslp.init deleted file mode 100755 index 31daa87..0000000 --- a/openslp.init +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# -# $Id: openslp.init,v 1.2 2003/05/30 12:59:30 rexdieter Exp $ -# -# chkconfig: 345 40 60 -# description: OpenSLP daemon for the Service Location Protocol -# processname: slpd - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -if [ -f /etc/sysconfig/slpd ]; then - . /etc/sysconfig/slpd -fi - -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - -RETVAL=0 - -prog="slpd" - -start () { - echo -n $"Starting $prog: " - daemon $prog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog - return $RETVAL -} - -stop () { - echo -n $"Stopping $prog: " - killproc $prog - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog - return $RETVAL -} - -reload(){ - echo -n $"Reloading configuration: " - killproc $prog -HUP - RETVAL=$? - echo - return $RETVAL -} - -restart () { - stop - start -} - -condrestart(){ - [ -e /var/lock/subsys/$prog ] && restart -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - reload) - reload - ;; - restart) - restart - ;; - condrestart) - condrestart - ;; - status) - status $prog - RETVAL=$? - ;; - *) - echo "Usage: $0 {start|stop|restart|reload|condrestart|status}" - exit 1 -esac - -exit $RETVAL diff --git a/openslp.spec b/openslp.spec index 9b23d18..840b0dd 100644 --- a/openslp.spec +++ b/openslp.spec @@ -1,20 +1,26 @@ -# $Id: openslp.spec,v 1.1 2004/11/08 04:56:10 cvsextras Exp $ +# $Id: openslp.spec,v 1.2 2004/11/08 04:56:22 cvsextras Exp $ -## kde-redhat macros -%define rhversion %(perl -pe '/(\\d+)\\.?(\\d)?/; $_="$1".($2||0)' /etc/redhat-release) +%define pie 1 Summary: OpenSLP implementation of Service Location Protocol V2 Name: openslp Epoch: 0 -Version: 1.0.11 -Release: 0.fdr.6.rh%{rhversion} +Version: 1.2.0 +Release: 0.fdr.4%{?dist_tag}.1 Group: System Environment/Libraries -License: Caldera Systems (BSD) -URL: http://www.openslp.org/ +License: BSD +#URL: http://www.openslp.org/ +URL: http://sourceforge.net/projects/openslp/ +Source: http://dl.sourceforge.net/sourceforge/openslp/openslp-1.2.0.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -Source0: ftp://openslp.org/pub/openslp/%{name}-%{version}/%{name}-%{version}.tar.gz -Source1: %{name}.init +Source1: slpd.init +Patch1: openslp-1.2.0-optflags.patch + +BuildRequires: autoconf automake libtool +BuildRequires: bison flex +#BuildRequires: byacc +BuildRequires: openssl-devel %description Service Location Protocol is an IETF standards track protocol that @@ -23,8 +29,7 @@ existence, location, and configuration of networked services in enterprise networks. OpenSLP is an open source implementation of the SLPv2 protocol as defined -by RFC 2608 and RFC 2614. This package include the daemon, libraries, header -files and documentation +by RFC 2608 and RFC 2614. %package devel Summary: OpenSLP headers and libraries @@ -33,14 +38,13 @@ Requires: %{name} = %{epoch}:%{version}-%{release} %description devel OpenSLP header files and libraries. -$Revision: 1.1 $ - %package server Summary: OpenSLP server daemon Group: System Environment/Daemons Requires: %{name} = %{epoch}:%{version}-%{release} -Requires(preun,post): chkconfig -Requires(preun,postun): /sbin/service +Requires(preun): chkconfig /sbin/service +Requires(post): chkconfig +Requires(postun): /sbin/service %description server OpenSLP server daemon to dynamically register services. @@ -48,20 +52,29 @@ OpenSLP server daemon to dynamically register services. %prep %setup -q +%patch1 -p1 -b .optflags + +libtoolize --force +aclocal +autoconf +automake --add-missing + # remove CVS leftovers... find . -name "CVS" | xargs rm -rf # remove hard-coded compiler flags: -O3 -Wall perl -pi -e "s@-O3@@g" configure -perl -pi -e "s@-Wall@@g" configure +#perl -pi -e "s@-Wall@@g" configure %build +%{?pie:export CFLAGS="-fPIC $RPM_OPT_FLAGS"; export LDFLAGS="-pie"} + %configure \ - --disable-static -# --enable-slpv2-security -# --enable-async-api + --disable-static +# --enable-slpv2-security +# --enable-async-api make %{?_smp_mflags} @@ -69,10 +82,9 @@ make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT -%makeinstall +make install DESTDIR=$RPM_BUILD_ROOT -install -D -m755 %{SOURCE1} \ - $RPM_BUILD_ROOT%{_initrddir}/slpd +install -p -D -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/slpd # nuke unpackaged/unwanted files rm -rf $RPM_BUILD_ROOT/usr/doc @@ -89,14 +101,14 @@ rm -rf $RPM_BUILD_ROOT %post server /sbin/chkconfig --add slpd -%preun server -if [ "$1" == "0" ]; then +%preun server +if [ $1 -eq 0 ]; then /sbin/service slpd stop >/dev/null 2>&1 ||: /sbin/chkconfig --del slpd fi %postun server -if [ "$1" -ge "1" ]; then +if [ $1 -ge 1 ]; then /sbin/service slpd condrestart >/dev/null 2>&1 fi @@ -127,35 +139,53 @@ fi %changelog -* Fri May 30 2003 Rex Dieter 0:1.0.11-0.fdr.6 +* Mon Jul 19 2004 Rex Dieter 0:1.2.0-0.fdr.4 +- BR: flex + +* Fri Jul 16 2004 Rex Dieter 0:1.2.0-0.fdr.3 +- BR: bison + +* Thu Jul 15 2004 Rex Dieter 0:1.2.0-0.fdr.2 +- fix/add condrestart to init script + +* Thu Jul 15 2004 Rex Dieter 0:1.2.0-0.fdr.1 +- 1.2.0 +- use -pie +- don't use Requires(post,postun) + +* Fri Oct 24 2003 Rex Dieter 0:1.0.11-0.fdr.7 +- fix for Fedora Core +- fix description (main package does *not* include daemon and header files). + +* Fri May 30 2003 Rex Dieter 0:1.0.11-0.fdr.6 - -server: Requires(preun,postun): /sbin/service - add a few more %%doc files to base pkg. - initscript: add (real) 'reload' action. - initscript: use $prog instead of hardcoded slpd. -* Fri May 16 2003 Rex Dieter 0:1.0.11-0.fdr.5 +* Fri May 16 2003 Rex Dieter 0:1.0.11-0.fdr.5 - -server: fix %postun on uninstall -* Thu May 2 2003 Rex Dieter 0:1.0.11-0.fdr.4 +* Thu May 2 2003 Rex Dieter 0:1.0.11-0.fdr.4 - *really* do %%config(noreplace) slp.conf -* Thu May 1 2003 Rex Dieter 0:1.0.11-0.fdr.3 +* Thu May 1 2003 Rex Dieter 0:1.0.11-0.fdr.3 - capitalize Summary's. - %%config(noreplace) slp.conf -* Thu May 1 2003 Rex Dieter 0:1.0.11-0.fdr.2 +* Thu May 1 2003 Rex Dieter 0:1.0.11-0.fdr.2 - docs: remove CVS files, include rfc, move ProgrammersGuide to -devel. - improve sub-pkg descriptions. - improve server %%preun,%%postun scripts: condrestart on upgrade, suppress output of server shutdown,restarts. -* Thu May 1 2003 Rex Dieter 0:1.0.11-0.fdr.1 +* Thu May 1 2003 Rex Dieter 0:1.0.11-0.fdr.1 - specfile cleanups for fedora packaging. -* Tue Apr 29 2003 Rex Dieter 0:1.0.11-0.fdr.0 +* Tue Apr 29 2003 Rex Dieter 0:1.0.11-0.fdr.0 - 1.0.11 release. - fedorize things -* Mon Feb 03 2003 Rex Dieter 0:1.0.10-1.0 +* Mon Feb 03 2003 Rex Dieter 0:1.0.10-1.0 - sanitize specfile - -devel,-server subpkgs. diff --git a/slpd.init b/slpd.init new file mode 100644 index 0000000..24b24c9 --- /dev/null +++ b/slpd.init @@ -0,0 +1,256 @@ +#!/bin/bash +# +# slpd Start/Stop the OpenSLP SA daemon (slpd). +# +# Author: Miquel van Smoorenburg, +# -Modified for RHS Linux by Damien Neil +# -Modified for COL by Raymund Will, +# -Modified for OpenSLP by Matt Peterson +# -Modified to be distribution agnostic by Bart Whiteley +# -Modified to be MORE agnostic by Erik Ratcliffe + +# Red Hat "chkconfig" init header: +# +# chkconfig: 345 13 87 +# description: slpd - OpenSLP daemon for the Service Location Protocol +# processname: slpd + +# LSB init header: +# +### BEGIN INIT INFO +# Provides: openslp slpd +# Required-Start: $named +# Required-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Description: slpd - OpenSLP daemon for the Service Location Protocol +### END INIT INFO + + +#///////////// multicast_route_set() //////////////# +# # +# 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 +} + + +NAME=slpd +DAEMON=/usr/sbin/$NAME + + +# Change to root +OLDDIR=`pwd` +cd / + + +# Source function library or libraries. Start with the +# uncommon ones like /etc[/rc.d]/init.d/functions, and then +# source in the LSB functions if they exist (which will +# override functions that may be defined in the former +# functions library). Finally, if /etc/sysconfig/slpd +# exists (like on SCO Linux systems), source it in Just +# In Case(tm). +if [ -f /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +else + if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions + fi +fi +if [ -f /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +fi +if [ -f /etc/sysconfig/$NAME ]; then + . /etc/sysconfig/$NAME +fi + + +# No executable daemon, no go... +test -x $DAEMON || exit 1 + + +# Lock files seem to be very, very consistent across distros... +LOCK=/var/lock/subsys/$NAME + + +# Run/PID files seem to be consistent as well... +RUNPID=/var/run/$NAME + + +# Make RETVAL default to 0... +RETVAL=0 + + +# +# See how we were called. +# + +case "$1" in + start) + # Check if we're already running... + if [ ! "$LOCK" = "" ] && [ -f $LOCK ]; then + exit 0 + fi + + echo -n 'Starting slpd: ' + + # Attempt to guarantee a multicast route... + multicast_route_set 1 + multicast_enabled=$? + if [ "$multicast_enabled" != "0" ] ; then + echo "Failure: No Route Available for Multicast Traffic" + exit 1 + fi + + # Try to start it up, beginning with LSB, then Red Hat, + # then OpenLinux. If there are other methods for starting + # daemons and they don't accidentally fall into one of those + # categories (look below before jumping to conclusions), let + # someone know so this can be fixed... + if [ -x /sbin/startproc ]; then + startproc $DAEMON $OPTIONS + RETVAL=$? + elif grep ^startproc\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \ + grep ^startproc\(\) /etc/init.d/functions > /dev/null 2>&1; then + startproc $DAEMON $OPTIONS + RETVAL=$? + elif grep ^daemon\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \ + grep ^daemon\(\) /etc/init.d/functions > /dev/null 2>&1; then + daemon $DAEMON + RETVAL=$? + else + if [ -x /sbin/ssd ]; then + ssd -S -n $NAME -x $DAEMON -- $OPTIONS + RETVAL=$? + fi + fi + + if [ $RETVAL -eq 0 ]; then touch $LOCK; fi + + echo + ;; + stop) + # Are we even running? Check first... + if [ -f $LOCK ]; then + echo -n 'Stopping slpd: ' + if [ -x /sbin/killproc ]; then + killproc $DAEMON + RETVAL=$? + elif grep killproc\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \ + grep killproc\(\) /etc/init.d/functions > /dev/null 2>&1; then + killproc $DAEMON + RETVAL=$? + else + if [ -x /sbin/ssd ]; then + ssd -K -p /var/run/$NAME.pid -n $NAME + RETVAL=$? + fi + fi + + if [ $RETVAL -eq 0 ]; then rm -f $LOCK; fi + else + echo "$NAME is not running" + RETVAL=0 + fi + + echo + ;; + reload|restart) + cd $OLDDIR + $0 stop + $0 start + RETVAL=$? + cd / + ;; + condrestart) + [ -f $LOCK ] && $0 restart || : + ;; + status) + if [ -x /sbin/checkproc ]; then + /sbin/checkproc $NAME > /dev/null 2>&1 + elif grep checkproc\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \ + grep checkproc\(\) /etc/init.d/functions > /dev/null 2>&1; then + checkproc $NAME > /dev/null 2>&1 + elif grep status\(\) /etc/rc.d/init.d/functions > /dev/null 2>&1 || \ + grep status\(\) /etc/init.d/functions > /dev/null 2>&1; then + status $NAME > /dev/null 2>&1 + else + pidof $NAME > /dev/null 2>&1 + fi + + RETVAL=$? + + if [ $RETVAL -eq 0 ]; then + echo "$NAME is running." + else + echo "$NAME is not running." + fi + ;; + *) + echo "Usage: slpd {start|stop|restart|reload|status}" + exit 1 +esac + +exit $RETVAL diff --git a/sources b/sources index 239440f..a61bc24 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0ec965956ad1f66850f050b19c828b55 openslp-1.0.11.tar.gz +b101a73c11d759c6d7a48483f887fae7 openslp-1.2.0.tar.gz