summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaul <paul>2005-06-15 11:00:11 +0000
committerpaul <paul>2005-06-15 11:00:11 +0000
commit9b78d0528ad6756b051d82faddfa2c3422403a2e (patch)
tree566594eea017950238265f3636860e3aaf2f68e5
parent62debbbe836d4c96402756ccfead01b09d903428 (diff)
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.
-rw-r--r--solaris/ChangeLog20
-rwxr-xr-xsolaris/quagga.init.in62
-rw-r--r--solaris/quagga.xml.in31
3 files changed, 67 insertions, 46 deletions
diff --git a/solaris/ChangeLog b/solaris/ChangeLog
index 0713a1f2..ab0c618e 100644
--- a/solaris/ChangeLog
+++ b/solaris/ChangeLog
@@ -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
diff --git a/solaris/quagga.init.in b/solaris/quagga.init.in
index 1d3a5cd3..ba3b484a 100755
--- a/solaris/quagga.init.in
+++ b/solaris/quagga.init.in
@@ -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
diff --git a/solaris/quagga.xml.in b/solaris/quagga.xml.in
index 1de74ffb..dfa2eb6b 100644
--- a/solaris/quagga.xml.in
+++ b/solaris/quagga.xml.in
@@ -39,19 +39,19 @@
<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>
@@ -125,8 +121,6 @@
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>
@@ -164,10 +158,6 @@
<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'>
@@ -205,10 +195,6 @@
<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'>
@@ -246,10 +232,6 @@
<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'>
@@ -285,11 +267,8 @@
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>