<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/
service_bundle.dtd.1'>

<!--
Copyright 2006, Sam Falkner.

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
  http://www.opensource.org/licenses/cddl1.php
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

  One way to use this:
    (1) install the p4 and p4d executables somewhere
    (2) edit the values where edits are invited below
    (3) Install this file as /var/svc/manifest/application/perforce.xml
    (4) run "svccfg import /var/svc/manifest/application/perforce.xml"
    (5) run "svcadm enable p4d"
  It is possible to use svccfg to change the configurable options,
instead
  of editing this XML file.  It is also possible to have more than one
  Perforce server running, by adding another instance.  See smf(5) for
  details.

-->


<service_bundle type='manifest' name='perforce-p4d-service'>
    <service
  name='application/perforce/p4d'
  type='service'
  version='1'>

        <create_default_instance enabled='false' />

        <dependency
    name='network'
    grouping='require_all'
    restart_on='error'
    type='service'>
            <service_fmri value='svc:/milestone/network' />
        </dependency>

        <dependency
    name='filesystem'
    grouping='require_all'
    restart_on='none'
    type='service'>
            <service_fmri value='svc:/system/filesystem/local' />
        </dependency>

        <dependent
    name='perforce-server_multi-user'
    grouping='optional_all'
    restart_on='none'>
            <service_fmri value='svc:/milestone/multi-user' />
        </dependent>

        <method_context>
            <method_credential user='daemon' group='daemon' />
        </method_context>

        <exec_method
   type='method'
   name='start'
   exec='%{executables/server} -r %{options/root} -J %{options/
journal} -p %{options/port}'
   timeout_seconds='4'>
        </exec_method>

        <exec_method
   type='method'
   name='stop'
   exec='%{executables/client} -u %{options/adminuser} -p %{options/
port} admin stop'
   timeout_seconds='32'>
        </exec_method>

        <property_group name='startd' type='framework'>
            <propval name='duration' type='astring' value='child' />
        </property_group>

        <property_group name='executables' type='application'>
            <propval name='server' type='astring'
             value='/usr/bin/p4d' />
            <propval name='client' type='astring'
             value='/usr/bin/p4' />
        </property_group>

        <property_group name='options' type='application'>
            <!-- Administrative user: edit this to the user (P4USER)
that
            has administrative privileges -->
            <propval name='adminuser' type='astring'
      value='p4admin' />

            <!-- Edit this to the root of your Perforce repository -->
            <propval name='root' type='astring'
      value='/var/perforce' />
            <!-- Edit this to the port you wish p4d to listen on -->
            <propval name='port' type='astring'
      value='1666' />
            <!-- Edit this if you wish to change the location of the
journal file -->
            <propval name='journal' type='astring'
      value='journal' />
            <!-- End of poperties to edit -->
        </property_group>

        <stability value='External' />

        <template>
            <common_name>
                <loctext xml:lang='C'>Perforce p4d server</loctext>
            </common_name>
            <documentation>
                <doc_link name='documentation' uri='http://
perforce.com/documentation/' />
            </documentation>
        </template>
    </service>
</service_bundle>