--- /dev/null Tue Jan 22 20:55:29 2008 +++ new/usr/src/cmd/ha-services/gds-agents/ids/ids_smf_register.ksh Tue Jan 22 20:55:29 2008 @@ -0,0 +1,153 @@ +#!/usr/bin/ksh +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (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/CDDL.txt +# 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/CDDL.txt. +# 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 +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +#ident "%Z%%M% %I% %E% SMI" +# +# +# DO NOT EDIT THIS FILE +# + +create_xml() +{ + MYDIR=/opt/SUNWscids + MANIFEST_DIR=/var/svc/manifest/application/sczone-agents + + [ ! -d "${MANIFEST_DIR}" ] && mkdir -p ${MANIFEST_DIR} + + cat > ${MANIFEST_DIR}/${RS}.xml <<-EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOF +} + +# $1 is passed from ids_register as ${TMP_WORK_CONFIG} +if [ -n "${1}" ] +then + . $1 +else + /usr/bin/printf "Configuration file not found\n" +fi + +create_xml + +/usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully created\n" + +if /usr/sbin/svccfg validate ${MANIFEST_DIR}/${RS}.xml; then + /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully validated\n" +else + /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml validation failed\n" + exit 1 +fi + +if /usr/sbin/svccfg import ${MANIFEST_DIR}/${RS}.xml; then + /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml successfully imported\n" +else + /usr/bin/printf "${MANIFEST_DIR}/${RS}.xml import failed\n" + exit 1 +fi + +exit 0