<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='netatalk'>

  <service 
	name='site/netatalk' 
	type='service' 
	version='0'>
	
	<create_default_instance enabled="true"/>

    	<!--
       	 	First of all, if the config file is not present,
       	 	then we needn't bother with anything else.  
    	-->

    	<dependency 
		name="netatalk-config-file" 
		grouping="require_all" 
		restart_on="none" 
		type="path">
	      <service_fmri value="file:///opt/netatalk/etc/netatalk/netatalk.conf"/>
    	</dependency>

	<dependency 
		name="afpd-config-file" 
		grouping="require_all" 
		restart_on="none" 
		type="path">
      		<service_fmri value="file:///opt/netatalk/etc/netatalk/afpd.conf"/>
    	</dependency>

	<dependency 
		name="AppleVolumes-default-config-file" 
		grouping="require_all" 
		restart_on="none" 
		type="path">
		<service_fmri value="file:///opt/netatalk/etc/netatalk/AppleVolumes.default"/>
	</dependency>
    
	<!--
      		If there's no network, then there's no point in running 
	-->

	<dependency 
		name='loopback' 
		grouping='require_all' 
		restart_on='error' 
		type='service'>
		<service_fmri value='svc:/network/loopback:default'/>
	</dependency>

	<dependency 
		name='physical' 
		grouping='optional_all' 
		restart_on='error' 
		type='service'>
		<service_fmri value='svc:/network/physical:default'/>
	</dependency>

	<!--
		Since netatalk may be providing a home directory service,
		it is as well that we ensure that the file-systems are
		all mounted before it is started. This is not essential
		but in general it is a good thing and doesn't really hurt. 
	-->
    
	<dependency 
		name='fs-local' 
		grouping='require_all' 
		restart_on='none' 
		type='service'>
		<service_fmri value='svc:/system/filesystem/local'/>
	</dependency>
    
	<!--
      		now we have the start stop and refresh methods
    	-->

    
	<exec_method 
		name='start' 
		type='method' 
		exec='/opt/local/lib/svc/method/netatalk start' 
		timeout_seconds='60'>
	</exec_method>
    
	<exec_method 
		name='stop' 
		type='method' 
		exec='/opt/local/lib/svc/method/netatalk stop' 
		timeout_seconds='60'>
	</exec_method>

	<template>
		<common_name>
          		<loctext xml:lang='C'>
				Netatalk Server
			</loctext>
        	</common_name>
	</template>

  </service>
</service_bundle>
