199ba4d70SRussell Blaine#!/bin/ksh 299ba4d70SRussell Blaine# 399ba4d70SRussell Blaine# CDDL HEADER START 499ba4d70SRussell Blaine# 599ba4d70SRussell Blaine# The contents of this file are subject to the terms of the 699ba4d70SRussell Blaine# Common Development and Distribution License (the "License"). 799ba4d70SRussell Blaine# You may not use this file except in compliance with the License. 899ba4d70SRussell Blaine# 999ba4d70SRussell Blaine# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1099ba4d70SRussell Blaine# or http://www.opensolaris.org/os/licensing. 1199ba4d70SRussell Blaine# See the License for the specific language governing permissions 1299ba4d70SRussell Blaine# and limitations under the License. 1399ba4d70SRussell Blaine# 1499ba4d70SRussell Blaine# When distributing Covered Code, include this CDDL HEADER in each 1599ba4d70SRussell Blaine# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1699ba4d70SRussell Blaine# If applicable, add the following below this CDDL HEADER, with the 1799ba4d70SRussell Blaine# fields enclosed by brackets "[]" replaced with your own identifying 1899ba4d70SRussell Blaine# information: Portions Copyright [yyyy] [name of copyright owner] 1999ba4d70SRussell Blaine# 2099ba4d70SRussell Blaine# CDDL HEADER END 2199ba4d70SRussell Blaine# 22*349b53ddSStuart Maybee# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2399ba4d70SRussell Blaine# Use is subject to license terms. 2499ba4d70SRussell Blaine 2599ba4d70SRussell Blaineinterval=$2 2699ba4d70SRussell Blaine 27*349b53ddSStuart Maybee. /lib/svc/share/smf_include.sh 28*349b53ddSStuart Maybee 29*349b53ddSStuart Maybee 30*349b53ddSStuart Maybeedisable_self() 31*349b53ddSStuart Maybee{ 32*349b53ddSStuart Maybee echo "This service will only run in a PV xVM domU." 33*349b53ddSStuart Maybee svcadm disable svc:/system/xvm/ipagent:default 34*349b53ddSStuart Maybee sleep 5 & 35*349b53ddSStuart Maybee exit $SMF_EXIT_OK 36*349b53ddSStuart Maybee} 37*349b53ddSStuart Maybee 38*349b53ddSStuart Maybeecheck_is_domu() 39*349b53ddSStuart Maybee{ 40*349b53ddSStuart Maybee if [ `uname -p` != "i386" -o `uname -i` != "i86xpv" ]; then 41*349b53ddSStuart Maybee disable_self 42*349b53ddSStuart Maybee fi 43*349b53ddSStuart Maybee 44*349b53ddSStuart Maybee /usr/sbin/devfsadm -i domcaps 45*349b53ddSStuart Maybee domcaps=`cat /dev/xen/domcaps 2>/dev/null` 46*349b53ddSStuart Maybee echo "$domcaps" | grep "control_d" > /dev/null 47*349b53ddSStuart Maybee if [ $? = 0 ]; then 48*349b53ddSStuart Maybee disable_self 49*349b53ddSStuart Maybee fi 50*349b53ddSStuart Maybee} 5199ba4d70SRussell Blaine 5299ba4d70SRussell Blainecase $1 in 5399ba4d70SRussell Blaine'start') 54*349b53ddSStuart Maybee check_is_domu 5599ba4d70SRussell Blaine 5699ba4d70SRussell Blaine /usr/lib/xen/bin/ipagent $interval & 5799ba4d70SRussell Blaine 5899ba4d70SRussell Blaine ;; 5999ba4d70SRussell Blaine 6099ba4d70SRussell Blaine*) 6199ba4d70SRussell Blaine echo "Usage: $0 start [report_interval]" 6299ba4d70SRussell Blaine exit 1 6399ba4d70SRussell Blaine ;; 6499ba4d70SRussell Blaineesac 6599ba4d70SRussell Blaine 6699ba4d70SRussell Blaineexit $? 67