Here's a manifest which answers the oft-asked question "what do I do 
with my ndd setting script from S9?".  My preference would have been to 
tell people that we have a better answer for them than running ndd 
commands during boot, but since we don't have a better answer yet I 
created a service.

The manifest is attached.  It's a very quick and dirty first hack, and
comments are appreciated.  There are more elegant solutions, such as 
using the repository to store the specific ndd settings, but that would 
have taken me more than 30 seconds to write and (nominally) test...  This
way seemed most obvious for people with existing scripts.

liane
-- 
Liane Praza, Solaris Kernel Development
liane.praza at sun.com - http://blogs.sun.com/lianep

-------------- next part --------------
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
 Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 Use is subject to license terms.

 CDDL HEADER START

 The contents of this file are subject to the terms of the
 Common Development and Distribution License, Version 1.0 only
 (the "License").  You may not use this file except in compliance
 with the License.

 You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 or http://www.opensolaris.org/os/licensing.
 See the License for the specific language governing permissions
 and limitations under the License.

 When distributing Covered Code, include this CDDL HEADER in each
 file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 If applicable, add the following below this CDDL HEADER, with the
 fields enclosed by brackets "[]" replaced with your own identifying
 information: Portions Copyright [yyyy] [name of copyright owner]

 CDDL HEADER END

        NOTE:  This service manifest is not editable; its contents will
        be overwritten by package or patch operations, including
        operating system upgrade.  Make customizations in a different
        file.

  To use this service, do the following:
        1) Install this file as /var/svc/manifest/site/ndd.xml
        2) As root, run:  svccfg import /var/svc/manifest/site/ndd.xml
        3) Create a shell script at /lib/svc/method/site-ndd which runs
           the appropriate ndd commands.
        4) As root, run:  svcadm enable ndd

  Alternatively, to do this during jumpstart:
        - Install this file as /var/svc/manifest/site/ndd.xml
        - Place an appropriate shell script at /lib/svc/method/site-ndd
        - Enable the ndd service in /var/svc/profile/site.xml
-->

<service_bundle type='manifest' name='site/ndd'>

<service
        name='site/ndd'
        type='service'
        version='1'>

        <create_default_instance enabled='false' />

        <!-- Wait for local filesystems to be available -->
        <dependency
                name='fs-local'
                grouping='require_all'
                restart_on='none'
                type='service'>
                <service_fmri value='svc:/system/filesystem/local' />
        </dependency>

        <!-- Run ndd commands after network/physical is plumbed. --> 
        <dependency
                name='network-physical'
                grouping='require_all'
                restart_on='none'
                type='service'>
                <service_fmri value='svc:/network/physical' />
        </dependency>

        <!-- but run the commands before network/initial -->
        <dependent
                name='ndd_network-initial'
                grouping='optional_all'
                restart_on='none'>
                <service_fmri value='svc:/network/initial' />
        </dependent>

        <exec_method
                type='method'
                name='start'
                exec='/lib/svc/method/site-ndd'
                timeout_seconds='300' />

        <exec_method
                type='method'
                name='stop'
                exec=':true'
                timeout_seconds='60' />

        <!--
             Re-running the script shouldn't interrupt service, so just
             do so when the admin runs "svcadm refresh ndd".
        -->
        <exec_method
                type='method'
                name='refresh'
                exec='/lib/svc/method/site-ndd'
                timeout_seconds='300' />

        <property_group name='startd' type='framework'>
                <propval name='duration' type='astring' value='transient' />
        </property_group>

        <stability value='Unstable' />

        <template>
                <common_name>
                        <loctext xml:lang='C'> site specific ndd commands
                        </loctext>
                </common_name>
                <documentation>
                        <manpage title='ndd' section='1M'
                                manpath='/usr/share/man' />
                </documentation>
        </template>
</service>

</service_bundle>

Reply via email to