xref: /illumos-gate/usr/src/cmd/xvm/ipagent/svc-ipagent (revision 3e04a86bb04fedaeff1b6921b4b38eb79897736d)
1#!/bin/ksh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24
25interval=$2
26
27. /lib/svc/share/smf_include.sh
28
29disable_self()
30{
31	echo "This service will only run in a PV xVM domU."
32	smf_method_exit $SMF_EXIT_TEMP_DISABLE "not an xVM domU"
33}
34
35check_is_domu()
36{
37	if [ `uname -p` != "i386" -o `uname -i` != "i86xpv" ]; then
38		disable_self
39	fi
40
41	/usr/sbin/devfsadm -i domcaps
42	domcaps=`cat /dev/xen/domcaps 2>/dev/null`
43	echo "$domcaps" | grep "control_d" > /dev/null
44	if [ $? = 0 ]; then
45		disable_self
46	fi
47}
48
49case $1 in
50'start')
51	check_is_domu
52
53	/usr/lib/xen/bin/ipagent $interval &
54
55	;;
56
57*)
58	echo "Usage: $0 start [report_interval]"
59	exit 1
60	;;
61esac
62
63exit $?
64