From 75db03ebb169da26102275c70eff0a0ebaae04cb Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 30 Mar 2006 13:38:28 +0000 Subject: [solaris] SMF manifest, method and depend updates. 2006-03-13 Alan Maguire * quagga.xml.in: Change the naming of services and instances. network/routing/quagga: may be neat and tidy, but it's at odds with SMF convention elsewhere that demands the service be named for what it does, and the instance name describe the implementation (e.g. network/smtp:sendmail). Remove call to method script for 'stop', SMF can do that itself. Enumerate the privileges required in the SMF manifest, with the method_credential element. Dont try provide seperate properties for each argument, it's just tedious, particularly when they can no longer be inherited from a common quagga service - use a single "daemon-args" property, defaulting to -P 0. Specify authorisation for the 'routeadm' utility and for RBAC. 2006-03-13 Paul Jakma * quagga.init.in: Update to match SMF manifest changes. If run from an SMF environment, assume method is start. Offer a more tradition init script interface for pre-SMF. Enable zebra for the link-state daemons. Don't allow daemons to start in non-global zones, except for bgpd - it doesn't have to care about underlying networking much. Remove all the svcprop calls, SMF or the user will supply any arguments on the command-line. * depend.smf.in: Add dependency on SUNWroute, which provides routeadm, which provides /var/svc/manifest/network/routing * prototype.smf.in: Install manifest to var/svc/manifest/network/routing. --- solaris/ChangeLog | 34 +++ solaris/depend.smf.in | 1 + solaris/prototype.smf.in | 2 +- solaris/quagga.init.in | 130 +++++---- solaris/quagga.xml.in | 695 +++++++++++++++++++++++++++++++++-------------- 5 files changed, 590 insertions(+), 272 deletions(-) (limited to 'solaris') diff --git a/solaris/ChangeLog b/solaris/ChangeLog index 13862147..4185d92e 100644 --- a/solaris/ChangeLog +++ b/solaris/ChangeLog @@ -1,3 +1,37 @@ +2006-03-13 Alan Maguire + + * quagga.xml.in: Change the naming of services and instances. + network/routing/quagga: may be neat and tidy, but + it's at odds with SMF convention elsewhere that demands + the service be named for what it does, and the instance name + describe the implementation (e.g. network/smtp:sendmail). + Remove call to method script for 'stop', SMF can do that + itself. + Enumerate the privileges required in the SMF manifest, with the + method_credential element. + Dont try provide seperate properties for each argument, it's + just tedious, particularly when they can no longer be + inherited from a common quagga service - use a single + "daemon-args" property, defaulting to -P 0. + Specify authorisation for the 'routeadm' utility and for + RBAC. + +2006-03-13 Paul Jakma + + * quagga.init.in: Update to match SMF manifest changes. + If run from an SMF environment, assume method is start. + Offer a more tradition init script interface for pre-SMF. + Enable zebra for the link-state daemons. + Don't allow daemons to start in non-global zones, except + for bgpd - it doesn't have to care about underlying + networking much. + Remove all the svcprop calls, SMF or the user will supply any + arguments on the command-line. + * depend.smf.in: Add dependency on SUNWroute, which provides + routeadm, which provides /var/svc/manifest/network/routing + * prototype.smf.in: Install manifest to + var/svc/manifest/network/routing. + 2006-02-19 Paul Jakma * depend.*: renamed to depend.*.in. diff --git a/solaris/depend.smf.in b/solaris/depend.smf.in index d078ea8e..6d928d2d 100644 --- a/solaris/depend.smf.in +++ b/solaris/depend.smf.in @@ -2,6 +2,7 @@ P QUAGGAdaemons Quagga daemons @PACKAGE_VERSION@,REV=@CONFDATE@ P SUNWcsu Core Solaris, (Usr) P SUNWcsr Core Solaris Libraries (Root) +P SUNWroute Network Routing daemons/commands (Usr) I SUNWzebrar I SUNWzebrau I CSWzebra diff --git a/solaris/prototype.smf.in b/solaris/prototype.smf.in index 3c80f39b..399a8d2d 100644 --- a/solaris/prototype.smf.in +++ b/solaris/prototype.smf.in @@ -3,6 +3,6 @@ i depend=$abs_builddir/depend.smf i copying=$abs_top_srcdir/COPYING i i.manifest i r.manifest -f manifest var/svc/manifest/network/quagga.xml 0444 root bin +f manifest var/svc/manifest/network/routing/quagga.xml 0444 root bin #f none var/svc/profile/@PACKAGE_TARNAME@_options.xml=$abs_builddir/options.xml 0755 root sys f none lib/svc/method/quagga=$abs_builddir/quagga.init 0755 root bin diff --git a/solaris/quagga.init.in b/solaris/quagga.init.in index 1fa98765..9fc2fe74 100755 --- a/solaris/quagga.init.in +++ b/solaris/quagga.init.in @@ -1,94 +1,104 @@ #!/sbin/sh # -# Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# $Id: quagga.init.in,v 1.5 2006/02/19 18:59:26 paul Exp $ +# $Id: quagga.init.in,v 1.6 2006/03/30 13:38:28 paul Exp $ # -# Starts/stops the appropriate daemon +# Starts/stops the given daemon SMFINCLUDE=/lib/svc/share/smf_include.sh +DAEMON_PATH=@sbindir@ +quagga_is_globalzone () { + if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then + return 1 + else + return 0 + fi +} + +# Include smf functions, if available. If not, define smf_present to indicate +# there is no SMF. Should allow this script to work pre-S10. if [ -f "$SMFINCLUDE" ] ; then . "$SMFINCLUDE"; +else + # pre-SMF system, fake up any functions and exit codes + # which SMFINCLUDE usually provides. + smf_present () { + return 1 + } + SMF_EXIT_OK=0; + SMF_EXIT_ERR_CONFIG=96; + SMF_EXIT_ERR_FATAL=95; fi + +# if there's no SMF, set some default DAEMON_ARGS +smf_present || DAEMON_ARGS="" usage () { - echo "Usage: $0 (start|stop) "; -} + if smf_present ; then + echo "Usage: $0 "; + else + echo "Usage: $0 "; + fi + echo "The --pid_file argument is implied"; + echo "This help message: $0 "; +} +# parse arguments, different according to SMF or not. case $1 in 'help' | 'usage') - usage - ;; + usage + exit SMF_EXIT_OK + ;; esac -# fmri and instance must be given. -FMRI="$2" -INSTANCE="$3" -if [ -z "$FMRI" -o -z "$INSTANCE" ]; then - usage - exit $SMF_EXIT_ERR_CONFIG +if smf_present ; then + QUAGGA_METHOD="start" +else + QUAGGA_METHOD="$1" + shift; fi -# fmri must exist -svcs ${FMRI} > /dev/null 2>&1 || exit $SMF_EXIT_ERR_CONFIG +DAEMON="$1" +shift +DAEMON_ARGS="$@" -case ${INSTANCE} in - zebra | bgpd ) +# daemon path must be given +if [ -z "$DAEMON_PATH/$DAEMON" ]; then + usage + exit $SMF_EXIT_ERR_FATAL +fi + +# only bgpd is suitable for running in a non-global zone, at this +# time. +case "${DAEMON}" in + zebra) + quagga_is_globalzone || exit $SMF_EXIT_OK + ;; + bgpd) ;; ospfd | ospf6d | ripd | ripngd ) - /usr/sbin/svcadm enable zebra + quagga_is_globalzone || exit $SMF_EXIT_OK ;; *) - usage - exit $SMF_EXIT_ERR_CONFIG; + usage + exit $SMF_EXIT_ERR_CONFIG; ;; esac -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}" - -# 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 -# we can assume it otherwise -if [ -z "${PIDFILE}" ]; then - PIDFILE="@quagga_statedir@/${INSTANCE}.pid" -else - ARGS="${ARGS} --pid_file ${PIDFILE}" -fi - -# we need @quagga_statedir@ to exist, it might be on tmpfs. +# we need @quagga_statedir@ to exist, it probably is on tmpfs. if [ ! -d @quagga_statedir@ ] ; then mkdir -p @quagga_statedir@ chown @enable_user@:@enable_group@ @quagga_statedir@ chmod 751 @quagga_statedir@ fi +PIDFILE="@quagga_statedir@/${DAEMON}.pid" + start () { - @sbindir@/${INSTANCE} ${ARGS} & + $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} & } stop () { @@ -97,17 +107,17 @@ stop () { fi } -case $1 in +case "$QUAGGA_METHOD" in 'start') - start ${2} + start ;; 'stop') - stop ${2} + stop ;; *) usage - exit 1 + exit SMF_EXIT_ERR_FATAL ;; esac diff --git a/solaris/quagga.xml.in b/solaris/quagga.xml.in index 5ce4aceb..45fa2148 100644 --- a/solaris/quagga.xml.in +++ b/solaris/quagga.xml.in @@ -8,15 +8,13 @@ --> - - + + + - + - + + + + + exec='/lib/svc/method/quagga zebra %{routing/daemon-args}' + timeout_seconds='60'> + + + + + exec=':kill' + timeout_seconds='60'> + - @@ -58,231 +67,495 @@ - - - - - - - + + + + - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - + + + + - - - - - - + type='service'> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + - - - - - - - - - + + - + + + + + + + + + - + + - + + + + + + + + + + + + + + + + + + -- cgit v1.2.1