]> git.proxmox.com Git - mirror_frr.git/commitdiff
2005-06-15 Paul Jakma <paul.jakma@sun.com>
authorpaul <paul>
Wed, 15 Jun 2005 11:00:11 +0000 (11:00 +0000)
committerpaul <paul>
Wed, 15 Jun 2005 11:00:11 +0000 (11:00 +0000)
* quagga.xml.in: Pass the FMRI to the method, removing need for
  daemon_name property and deducing the FMRI.
  remove the empty config_file and pid_file definitions, they just
  make things difficult in the method script, cause it then has to
  deal with svcprop returning "" for defined empty properties.
  Remove daemon_name everywhere.
* quagga.init.in: Take the FMRI as an argument
  Remove deducing the FMRI from the defunct daemon_name property.
  Use svcprop -q to test for presence of a property first.
  Default vty_port to 0 and vty_addr to 127.1 if equivalent
  SMF properties are not set.
  Deduce the pid_file, we can infer it from @quagga_statedir@ I
  think, it's probably not useful to allow it to be configurable
  as a property anyway.
  /var/run/ is on tmpfs on Solaris, so we probably will need
  to create @quagga_statedir@ first run after boot.
  Use @sbindir@, not /usr/local/sbin.

solaris/ChangeLog
solaris/quagga.init.in
solaris/quagga.xml.in

index 0713a1f237bc870d0ac3e3d96dfb0e36b5d60554..ab0c618e9cf99755726e43af020f16615e11f7fc 100644 (file)
@@ -1,3 +1,23 @@
+2005-06-15 Paul Jakma <paul.jakma@sun.com>
+
+       * quagga.xml.in: Pass the FMRI to the method, removing need for
+         daemon_name property and deducing the FMRI.
+         remove the empty config_file and pid_file definitions, they just
+         make things difficult in the method script, cause it then has to
+         deal with svcprop returning "" for defined empty properties.
+         Remove daemon_name everywhere.
+       * quagga.init.in: Take the FMRI as an argument
+         Remove deducing the FMRI from the defunct daemon_name property.
+         Use svcprop -q to test for presence of a property first.
+         Default vty_port to 0 and vty_addr to 127.1 if equivalent
+         SMF properties are not set.
+         Deduce the pid_file, we can infer it from @quagga_statedir@ I
+         think, it's probably not useful to allow it to be configurable
+         as a property anyway.
+         /var/run/ is on tmpfs on Solaris, so we probably will need
+         to create @quagga_statedir@ first run after boot.
+         Use @sbindir@, not /usr/local/sbin.
+         
 2005-06-02 Paul Jakma <paul.jakma@sun.com>
 
        * quagga.xml.in: Fix mistake in bgpd definition. Change dependency
index 1d3a5cd3e78f32a9c8e369d2dfb35e498361b733..ba3b484a904436431aed4615027dab06272c2127 100755 (executable)
@@ -3,7 +3,7 @@
 # Copyright 2001,2003 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# $Id: quagga.init.in,v 1.3 2005/06/02 16:33:53 paul Exp $
+# $Id: quagga.init.in,v 1.4 2005/06/15 11:00:11 paul Exp $
 #
 # Starts/stops the appropriate daemon
 
@@ -14,7 +14,7 @@ if [ -f "$SMFINCLUDE" ] ; then
 fi
 
 usage () {
-       echo "Usage: $0 (start|stop) <fmri>";
+       echo "Usage: $0 (start|stop) <fmri> <instance>";
 }      
 
 case $1 in
@@ -23,9 +23,10 @@ case $1 in
        ;;
 esac
 
-# fmri must be given.
+# fmri and instance must be given.
 FMRI="$2"
-if [ -z "$FMRI" ]; then
+INSTANCE="$3"
+if [ -z "$FMRI" -o -z "$INSTANCE" ]; then
        usage
        exit $SMF_EXIT_ERR_CONFIG
 fi
@@ -33,10 +34,7 @@ fi
 # fmri must exist
 svcs ${FMRI} > /dev/null 2>&1 || exit $SMF_EXIT_ERR_CONFIG
 
-DAEMON=`svcprop -p @PACKAGE_TARNAME@/daemon_name ${FMRI} 2> /dev/null`
-[ -z "${DAEMON}" ] && exit $SMF_EXIT_ERR_CONFIG
-
-case ${DAEMON} in
+case ${INSTANCE} in
        zebra | ospfd | ospf6d | ripd | ripngd | bgpd )
        ;;
        *)
@@ -45,28 +43,52 @@ case ${DAEMON} in
        ;;
 esac
 
-CONFFILE=`svcprop -p @PACKAGE_TARNAME@/config_file ${FMRI}`
-PIDFILE=`svcprop -p @PACKAGE_TARNAME@/pid_file ${FMRI}`
-USER=`svcprop -p @PACKAGE_TARNAME@/user ${FMRI}`
-GROUP=`svcprop -p @PACKAGE_TARNAME@/group ${FMRI}`
-VTYADDR=`svcprop -p @PACKAGE_TARNAME@/vty_addr ${FMRI}`
-VTYPORT=`svcprop -p @PACKAGE_TARNAME@/vty_port ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/config_file ${FMRI} && \
+       CONFFILE=`svcprop -p @PACKAGE_TARNAME@/config_file ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/pid_file ${FMRI} && \
+       PIDFILE=`svcprop -p @PACKAGE_TARNAME@/pid_file ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/user ${FMRI} && \
+       USER=`svcprop -p @PACKAGE_TARNAME@/user ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/group ${FMRI} && \
+       GROUP=`svcprop -p @PACKAGE_TARNAME@/group ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/vty_addr ${FMRI} && \
+       VTYADDR=`svcprop -p @PACKAGE_TARNAME@/vty_addr ${FMRI}`
+svcprop -q -p @PACKAGE_TARNAME@/vty_port ${FMRI} && \
+       VTYPORT=`svcprop -p @PACKAGE_TARNAME@/vty_port ${FMRI}`
 
 [ -n "${CONFFILE}" ] && ARGS=" -f ${CONFFILE}"
 [ -n "${PIDFILE}" ] && ARGS="${ARGS} --pid_file ${PIDFILE}"
 [ -n "${USER}" ] && ARGS="${ARGS} --user ${USER}"
 [ -n "${GROUP}" ] && ARGS="${ARGS} --group ${GROUP}"
-[ -n "${VTYPORT}" ] && ARGS="${ARGS} --vty_port ${VTYPORT}"
-[ -n "${VTYADDR}" ] && ARGS="${ARGS} --vty_addr ${VTYADDR}"
+
+# vty should default to disabled, ie port == 0
+[ -z "${VTYPORT}" ] && VTYPORT=0
+ARGS="${ARGS} --vty_port ${VTYPORT}"
+
+# default listen address should be localhost
+[ -z "${VTYADDR}" ] && VTYADDR=127.1
+ARGS="${ARGS} --vty_addr ${VTYADDR}"
 
 # have to have a pid file for script to work
-[ -z "${PIDFILE}" ] && exit $SMF_EXIT_ERR_CONFIG
+# we can assume it otherwise
+if [ -z "${PIDFILE}" ]; then
+       PIDFILE="@quagga_statedir@/${INSTANCE}.pid"
+else
+       ARGS="${ARGS} --pid_file ${PIDFILE}"
+fi
 
 # config file must exist
 #[ ! -f "$CONFFILE" ] &&  exit $SMF_EXIT_ERR_CONFIG
 
+# we need @quagga_statedir@ to exist, it might be on tmpfs.
+if [ ! -d @quagga_statedir@ ] ; then
+       mkdir -p @quagga_statedir@
+       chown @enable_user@:@enable_group@ @quagga_statedir@
+       chmod 751 @quagga_statedir@
+fi
+
 start () {
-       /usr/local/quagga/sbin/${DAEMON} ${ARGS} &
+       @sbindir@/${INSTANCE} ${ARGS} &
 }
 
 stop () {
@@ -76,9 +98,9 @@ stop () {
 }
 
 restart() {
-       stop ${DAEMON}
+       stop ${INSTANCE}
        sleep 1
-       start ${DAEMON}
+       start ${INSTANCE}
 }
 
 case $1 in 
index 1de74ffb0d0f42e3c0a7696784578ad7922e2b4a..dfa2eb6b5201eaa8e9ec9e63a30d73179616e079 100644 (file)
        <exec_method
                type='method'
                name='start'
-               exec='/lib/svc/method/quagga start %i'
+               exec='/lib/svc/method/quagga start %f %i'
                timeout_seconds='60'/>
 
        <exec_method
                type='method'
                name='stop'
-               exec='/lib/svc/method/quagga stop %i'
+               exec='/lib/svc/method/quagga stop %f %i'
                timeout_seconds='60' />
 
        <exec_method
                type='method'
                name='restart'
-               exec='/lib/svc/method/quagga restart %i'
+               exec='/lib/svc/method/quagga restart %f %i'
                timeout_seconds='60' />
        <!-- 
                if we define these properties at the service level, each instance
@@ -65,8 +65,6 @@
        </property_group>
        <property_group name='quagga' type='application'>
                <!-- Options common to Quagga daemons -->       
-               <propval name='config_file' type='astring' value='' />
-               <propval name='pid_file' type='astring' value='' />
                <propval name='vty_addr' type='astring' value='127.1' />
                <propval name='vty_port' type='integer' value='0'/>
                <propval name='user' type='astring' value='@enable_user@' />
@@ -89,8 +87,6 @@
                <property_group name='quagga' type='application'>
                        <propval name='keep_kernel' type='boolean' 
                                value='false'/>
-                       <propval name='daemon_name' type='astring'
-                               value='zebra'/>
                </property_group>
                <template>
                        <common_name>
                            value='file://localhost/@sysconfdir@/bgpd.conf' />
                </dependency>
                <property_group name='quagga' type='application'>
-                       <propval name='daemon_name' type='astring'
-                               value='bgpd'/>
                        <propval name='no_kernel' type='boolean'
                                value='false'/>
                </property_group>
                        <service_fmri
                            value='file://localhost/@sysconfdir@/ospf6d.conf' />
                </dependency>
-               <property_group name='quagga' type='application'>
-                       <propval name='daemon_name' type='astring'
-                               value='ospf6d'/>
-               </property_group>
                <template>
                        <common_name>
                                <loctext xml:lang='C'>
                <property_group name='quagga' type='application'>
                        <propval name='retain_routes' type='boolean' value='false'/>
                </property_group>
-               <property_group name='quagga' type='application'>
-                       <propval name='daemon_name' type='astring'
-                               value='ospfd'/>
-               </property_group>
                <template>
                        <common_name>
                                <loctext xml:lang='C'>
                <property_group name='quagga' type='application'>
                        <propval name='retain_routes' type='boolean' value='false'/>
                </property_group>
-               <property_group name='quagga' type='application'>
-                       <propval name='daemon_name' type='astring'
-                               value='ripd'/>
-               </property_group>
                <template>
                        <common_name>
                                <loctext xml:lang='C'>
                            value='file://localhost/@sysconfdir@/ripngd.conf' />
                </dependency>
                <property_group name='quagga' type='application'>
-                       <propval name='retain_routes' type='boolean' value='false'/>
-               </property_group>
-               <property_group name='quagga' type='application'>
-                       <propval name='daemon_name' type='astring'
-                               value='ripngd'/>
+                       <propval name='retain_routes' type='boolean' 
+                               value='false'/>
                </property_group>
                <template>
                        <common_name>