fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#!/usr/bin/ksh
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
9444c26f4faabda140242c3986089704c4073cedTom Whitten# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypeset -r PROG=$(basename $0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypeset -r CTAG_NULL="-"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# help message
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortehelp()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cluster_configured
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CLUSTER_CONFIGURED=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteusage:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $PROG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $PROG -i
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $PROG -e [-r][-p]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $PROG -d [-r]" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $CLUSTER_CONFIGURED -eq 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $PROG -s" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -i : display information on the Availability Suite services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -e : enable Availability Suite services (all, by default)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -d : disable Availability Suite services (all, by default)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -r : enable/disable Remote Mirror
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -p : enable Point in Time Copy" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $CLUSTER_CONFIGURED -eq 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -s : set the location of the cluster configuration database" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -x : turn on script debugging (may be used with any valid option)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte When executed with no options or with nothing but -x, $PROG runs in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte interactive fashion, allowing the user to initialize the local (and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if applicable, the cluster) configuration database, and to start the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Availability Suite services." >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## SET GLOBAL VARIABLES ######################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# root directory
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePKG_INSTALL_ROOT=""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport PKG_INSTALL_ROOT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set lib path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteLD_LIBRARY_PATH=/usr/lib:/usr/lib
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport LD_LIBRARY_PATH
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set dscfg
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDSCFG="/usr/sbin/dscfg"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport DSCFG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set parser config location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePCONFIG="/etc/dscfg_format"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport PCONFIG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set local dscfg location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport LOCAL_DSCFG="/etc/dscfg_local"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set cluster dscfg reference file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport CLUSTER_REF="/etc/dscfg_cluster"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# a service that has a dependency on us
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteFS_LOCAL_SVC="svc:/system/filesystem/local"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteNODELIST="/tmp/nodelist"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDSCFGLOCKDCF="/etc/dscfg_lockdb"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDSCFG_DEPEND_NOCHK="/tmp/.dscfgadm_pid"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# SMF defines
9444c26f4faabda140242c3986089704c4073cedTom WhittenMANIFEST_PATH=/lib/svc/manifest/system
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# SMF services (enable and disable)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSMF_ENABLE="nws_scm nws_sv nws_ii nws_rdc nws_rdcsyncd"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSMF_DISABLE="nws_rdcsyncd nws_rdc nws_ii nws_sv nws_scm"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# state of each service
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenws_scm_enabled=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenws_sv_enabled=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenws_ii_enabled=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenws_rdc_enabled=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenws_rdcsyncd_enabled=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePATH=/usr/bin:/usr/sbin:/sbin/sh
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport PATH
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set architecture
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteARCH=`uname -p`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteexport ARCH
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteOS_MINOR=`uname -r | cut -d '.' -f2`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# number of sectors required for database
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 1024*1024*5.5/512
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteREQUIRED=11264
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# must set here, else seen as null in MAIN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteVALID_DB_ENTERED=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteNO_ARGS=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# for debugging
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortexopt=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set lengthy message here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteCLUST_LOC_MESS="The current location is invalid for a Sun StorageTek \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteData Services configuration database. Once a valid location is \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteentered (raw slice on \"did\" device), you may upgrade the existing \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedatabase to this new location - following the procedure outlined \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortein the Installation and Configuration Guide."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## SET GLOBAL VARIABLES ######################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## ERROR ####################################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# called with optional error msg $1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# prints basic guidelines for configuration of the database location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteerror()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "INSTALLATION ERROR" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Error: $1" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte in_cluster
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -eq 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "GENERAL INSTALLATION RULES:" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\tBecause you are installing on a cluster," >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\tthe database must be located on a raw slice of a did device.">&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\t e.g. /dev/did/rdsk/d17s1" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # let?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MB=`expr $REQUIRED / 2 / 1024`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\t$REQUIRED sectors ($MB MBs) are required for the database." >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## ERROR ####################################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## ALL LOCATION TESTS ########################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# sets numerous environment variables describing the state of the system
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_system_state()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte valid_local_dscfg_exists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_LOCAL_DB=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_VALID_LOCAL_DB=$VALID_LOCAL_DB
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte in_cluster
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IN_CLUSTER=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cluster_configured
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CLUSTER_CONFIGURED=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $IN_CLUSTER = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte valid_cluster_dscfg_exists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_CLUSTER_DB=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_VALID_CLUSTER_DB=$VALID_CLUSTER_DB
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_CLUSTER_DB=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Checks if in cluster
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns 1 if in cluster, else 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortein_cluster()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -x /usr/sbin/clinfo ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte clinfo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -eq 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# checks if a system is configured as a cluster
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns 1 if configured as a cluster, 0 if not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecluster_configured()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -f /etc/cluster/nodeid ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Check the list of Sun Cluster device groups known in the dscfg, determing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# if they are currently enabled on this Sun Cluster node. If so, fail allowing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# the system administator to scswitch them elsewhere.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecheck_device_groups()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_CLUSTER_DB == 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEVICE_GROUPS=`$DSCFG -s $FILE_LOC -l 2>/dev/null | \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte grep "^dsvol:" | cut -d' ' -f3 | sort | uniq | xargs`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for x in $DEVICE_GROUPS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $DSCFG -D $x 2>/dev/null
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -eq 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IN_USE="$IN_USE $x"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -n "$IN_USE" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "The following Sun Cluster device groups are in use "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "by Availability Suite on this node."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print ""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "$IN_USE"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print ""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "'scswitch' them to another Sun Cluster node before "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "attempting to disable any data services."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# checks to see if this is a char device in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# /dev/did/rdsk directory returns 1 if so.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteis_did_device()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DID=`echo $1 | awk -F/ '{print $3}'`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RDSK=`echo $1 | awk -F/ '{print $4}'`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ "did" = $DID -a "rdsk" = $RDSK -a -c $1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# checks size of area for db location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecheck_size()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if in cluster look for d*s*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SLICE=`echo $1 | sed -n 's/.*d.*s\(.*\)/\1/p'`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SECTORS=`prtvtoc $1 | tr -s ' '| grep "^ $SLICE " | awk '{print $5}'`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -z "$SECTORS" ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "SLICE at $1 not found on this device"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if required size is greater than space available, then fail
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $REQUIRED -gt $SECTORS ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# looks in dscfg_cluster reference file. if a location is configured,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# tests to see if it is a valid database. if so, returns 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevalid_cluster_dscfg_exists()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -s $CLUSTER_REF ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE_LOC=`head -1 $CLUSTER_REF`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte contains_data $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return $?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# checks for the existence of dscfg_local database, and if it exists,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# tests to see if it is a valid database. if so, returns 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevalid_local_dscfg_exists()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -s $LOCAL_DSCFG ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte contains_data $LOCAL_DSCFG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return $?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# used to test if a valid DS config database exists on machine already
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# MAGIC_STRING is the top line in the config used in v3.1 & v3.2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecontains_data()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # dscfg distinct strings, varies on the architecture
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $ARCH = "sparc" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAGIC_STRING="MAGI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elif [ $ARCH = "i386" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAGIC_STRING="IGAM"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # Create a PID unique temporary file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TMP_FILE=/tmp/$$
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # Write the first or 16th block (skipping over VTOC) to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # the TMP_FILE, then scan for the presence of the "MAGI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for offset in 0 16
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ ! -z "$1" ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dd if=$1 of=$TMP_FILE count=1 iseek=$offset 2>/dev/null
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILECONTENTS=`strings $TMP_FILE | head -1 2>/dev/null`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ `echo $FILECONTENTS | grep -c "$MAGIC_STRING"` -gt 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm $TMP_FILE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm $TMP_FILE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## ALL LOCATION TESTS ########################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## MAIN FUNCTIONS ############################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# since location already has been set, asks what to do now? keeping
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# it still checks the size (since an upgrade from 3.0 may still be
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# occuring) and also checks if was an old cluster config on disallowed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# /dev/did/dsk directory
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 0 if cluster location is invalid or the user does not want to keep it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 1 if the location is valid and the user wants to keep it.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekeep_it()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOTE="\nThe Sun StorageTek Data Services database configuration"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOTE="$NOTE location has already been set."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo $NOTE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\nCurrent location: $PKG_INSTALL_ROOT$FILE_LOC"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QUEST="Would you like to preserve the existing configuration"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QUEST="$QUEST information at its current location? "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ANS=`ckyorn -Qd n -p "$QUEST"`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case $ANS in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte y|Y|yes|YES|Yes)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #Since the user has said "yes I want to keep this current one"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #it may actually be a 3.x database, which only required 4.5mb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #space, so now will check that there is room to grow another 1mb"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_location $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error "$CLUST_LOC_MESS"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_FILE_LOC=$FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE_LOC=$NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte esac
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# asks if user wants to keep existing db information, overwrite with
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# a new db, or view the contents, and be asked again...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 0 if old location is bad
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 1 if old location is good
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepreserve_overwrite_maybe()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\nIt appears a valid database configuration exists here already."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while true
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SAFE_LOC=$FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\nWould you like to preserve this information and continue?"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\ty - preserve current configuration"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\tn - overwrite with new configuration"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\tmaybe - view contents of current configuration"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ANS=`ckkeywd -Q y n maybe`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case $ANS in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte y)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_location $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error "$CLUST_LOC_MESS"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $DSCFG -s "$FILE_LOC" -C $CTAG_NULL >/dev/null 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OLD_FILE_LOC=$FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE_LOC=$NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_location $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error "$CLUST_LOC_MESS"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte maybe)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # print contents of this db config.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\nContents of database configuration found at $SAFE_LOC are:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $DSCFG -l -s "$FILE_LOC" | more
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE_LOC=$SAFE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte esac
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# gets location from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_location()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #Checks for absolute path name, and if file name and file doesn't
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #exist, creates it.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\n\n----------ENTER DATABASE CONFIGURATION LOCATION-----------------"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Note: Please ensure this location meets all requirements specified"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "in the Availability Suite Installation Guide."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE_LOC=`ckpath -artwQ -p "Enter location:"`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # allow non-root user to access for least privileges
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chmod 666 $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# tests for proper config
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 0 if bad location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 1 if good location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecheck_location()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # set to FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LOCATION=$1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte did_clust_msg="You are in cluster and $LOCATION is not valid DID device"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # Set "actual file location" variable here to equal file location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # entered by user because getting here means contains_data was already
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # successfully called before and now the two can equal each other for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # future testing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SAFE_LOC=$FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $IN_CLUSTER = 1 -o $CLUSTER_CONFIGURED = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -b "$LOCATION" ] || [ -c "$LOCATION" ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_did_device $LOCATION
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error "$did_clust_msg"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error "$did_clust_msg"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Location may not be changed in a non Sun Cluster OE." 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_size $LOCATION
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error "$LOCATION does not meet minimum space requirement."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Notifies the user that the SMF services are online,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# and gives him the option to disable the services before proceeding. If
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# the services are not disabled, the program cannot proceed with setting
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# a new dscfg location.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteask_to_disable()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte\nYour services must be disabled before a new configuration location is set.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QUEST="Would you like to disable the services now and continue with the"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QUEST="$QUEST Availability Suite setup? "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ANS=`ckyorn -Qd n -p "$QUEST"`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case $ANS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte in y|Y|yes|YES|Yes)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte esac
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Asks the user if he would like to enable the services now. If so,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# import them (if necessary) and enable them.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteask_to_enable()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte\nIf you would like to start using the Availability Suite immediately, you may
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestart the SMF services now. You may also choose to start the services later
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteusing the $PROG -e command."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QUEST="Would you like to start the services now? "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ANS=`ckyorn -Qd n -p "$QUEST"`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case $ANS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte in y|Y|yes|YES|Yes)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte esac
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# display information about the system
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_info()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset grp_error_flg=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset -L15 svc state en SVC="SERVICE" STATE="STATE" EN="ENABLED"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "$SVC\t$STATE\t$EN"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for i in $SMF_ENABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_imported $i
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state=`svcprop -c -p restarter/state \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svc:/system/${i}:default`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte en=`svcprop -c -p general/enabled \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svc:/system/${i}:default`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_fs_local_grouping $i
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svc="${i}***"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte grp_error_flg=$((grp_error_flg + 1))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svc=$i
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "$svc\t$state\t$en"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "\nAvailability Suite Configuration:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "Local configuration database: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_LOCAL_DB = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "valid"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "invalid"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $CLUSTER_CONFIGURED = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "cluster configuration database: "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_CLUSTER_DB = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "valid"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "cluster configuration location: ${FILE_LOC}"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "invalid"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $grp_error_flg -gt 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset p
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset p_has
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $grp_error_flg -gt 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p="s"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_has="have"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p=""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_has="has"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "\n*** Warning: The service$p above $p_has an incorrect "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "dependency. To repair the\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "problem, run \"dscfgadm\".\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# initialize the local configuration database (only called if none exists)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns 0 if successful, 1 if failed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteinitialize_local_db()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Could not find a valid local configuration database."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Initializing local configuration database..."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo y | ${DSCFG} -i > /dev/null 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ${DSCFG} -i -p ${PCONFIG} > /dev/null 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # Make sure the new location is initialized properly
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte valid_local_dscfg_exists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_LOCAL_DB=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_LOCAL_DB != 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Unable to initialize local configuration database" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Successfully initialized local configuration database"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# initialize the cluster configuration database, if necessary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns 0 if successful, 1 if failed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteinitialize_cluster_db()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ ! -n "$FILE_LOC" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Initializing cluster configuration database..."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ${DSCFG} -s ${FILE_LOC} -C $CTAG_NULL > /dev/null 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo y | ${DSCFG} -i -C $CTAG_NULL > /dev/null 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ${DSCFG} -i -p ${PCONFIG} -C $CTAG_NULL > /dev/null 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # make sure the cluster db is valid now
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte valid_cluster_dscfg_exists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_CLUSTER_DB=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_CLUSTER_DB != 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Unable to initialize cluster configuration database" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Successfully initialized cluster configuration database"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# prompt the user for a config location and set AVS to use that location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteset_cluster_config()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte$xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteREPEAT=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewhile [ $REPEAT -eq 0 ]; do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # See if user has entered location already, and it was an existing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # db. Retruns FILE_LOC value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_DB_ENTERED = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # reset
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_DB_ENTERED=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte preserve_overwrite_maybe
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if 1, location passes, and FILE_LOC being passed to end, else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # set VALID_CLUSTER_DB to 0 since the "valid one" isn't valid anymore
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # (bad size, etc) thereby when looping go straight to get_location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte REPEAT=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_CLUSTER_DB=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if 1, then valid db exists, now see what user wants to do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_CLUSTER_DB = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SAFE_LOC=$FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte keep_it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if 0, then user can't or won't keep location. set PROMPT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # so we will get new location from user.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PROMPT=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PROMPT=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if either are 0, then user wants or needs new db as outlined in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # earlier comments
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_CLUSTER_DB = 0 ] || [ $PROMPT = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # We cannot proceed if the services are running. Give the user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # a chance to stop the services. If he chooses not to, bail.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte show_enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ask_to_disable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "A new configuration location was not set."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disable_services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte get_location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte contains_data $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if 1, then user entered an existsing db location, loop
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # back to ask what to do with it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_DB_ENTERED=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_location $FILE_LOC
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if 0, that means location has failed, loop and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # get_location again
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VALID_CLUSTER_DB=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # entered location passes tests
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte REPEAT=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # user wants to leave location where and how it is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # FILE_LOC being passed all the way to end
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte REPEAT=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedone
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## MAIN FUNCTIONS ############################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte######################## SMF HELPER FUNCTIONS ########################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# check if any SMF service is online (enabled)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecheck_enabled()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset ret=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in $SMF_ENABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_enabled $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte eval ${svc}_enabled=$?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret=$((ret | ${svc}_enabled))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return $ret
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Display which services are enabled. (Must be called after check_enabled)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteshow_enabled()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "\nThe following Availability Suite services are enabled:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in $SMF_ENABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (( ${svc}_enabled == 1 ))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "$svc "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo ""
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# check if the given SMF service is online (enabled)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $1: service name to check for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteis_enabled()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset en
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_imported $1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte en=`svcprop -c -p general/enabled svc:/system/${1}:default`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $en = "true" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# If necessary, flag no dependency check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteno_depend_check()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset pid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset msg=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $OS_MINOR -lt 11 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -f $DSCFG_DEPEND_NOCHK ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pid=`cat $DSCFG_DEPEND_NOCHK`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Another dscfgadm disable is in progress."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Waiting for pid: $pid to terminate..."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while [ -f $DSCFG_DEPEND_NOCHK ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (( msg && (msg % 6 == 0)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "\nAnother dscfgadm disable "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "(pid: $pid) still appears to "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf " be in progress.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "If this is not the case, you "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "may remove "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "$DSCFG_DEPEND_NOCHK.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sleep 5
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte msg=$((msg + 1))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte touch $DSCFG_DEPEND_NOCHK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo $$ >> $DSCFG_DEPEND_NOCHK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# If necessary, remove the no dependency check flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterm_no_depend_check()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $OS_MINOR -lt 11 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm -f $DSCFG_DEPEND_NOCHK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set the filesystem/local dependency type and refresh
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $1: service name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $2: either "require_all" or "optional_all"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteset_fs_local_grouping()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc=$1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset dep_group=$2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # set proper dependency type for fs-local
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $svc != nws_rdcsyncd ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svccfg -s $FS_LOCAL_SVC setprop \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ${svc}-local-fs/grouping=$dep_group
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "command failed: svccfg -s $FS_LOCAL_SVC "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "setprop ${svc}-local-fs/grouping=$dep_group "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf ">&2\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # we need local-fs to know about the new grouping attributes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svcadm refresh ${FS_LOCAL_SVC}:default
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print "Failed to refresh ${FS_LOCAL_SVC} >&2"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# check if the grouping dependency type for filesystem/local is correct
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# input:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $1: service name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 0 if the setting is correct
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 1 if the setting is incorrect
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# outputs: sets CORRECT_GROUPING with the value of what the grouping should be.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecheck_fs_local_grouping()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc=$1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset cur_grouping
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $svc = nws_rdcsyncd ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # If it's not imported, we just return success, since we don't want
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # further processing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_imported $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # get the current grouping value from the repository
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur_grouping=`svcprop -c -p ${svc}-local-fs/grouping $FS_LOCAL_SVC`
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # Figure out what the grouping should be (based on enabled status)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_enabled $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CORRECT_GROUPING="require_all"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CORRECT_GROUPING="optional_all"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ "$cur_grouping" != "$CORRECT_GROUPING" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # grouping is incorrect
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # grouping is just fine
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# enable/disable the given SMF service. Also, update the filesystem-local
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# dependency, if appropriate.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $1: service name to check for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $2: "enable" or "disable"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesvc_operation()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc=$1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset command=$2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset enable_state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset dep_group
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # If disabling, then enable_state better be true, and we are
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # transitioning to "option_all" grouping
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $command = "disable" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enable_state=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dep_group="optional_all"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # If enabling, then enable_state better be false, and we are
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # transitioning to "require_all" grouping
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elif [ $command = "enable" ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enable_state=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dep_group="require_all"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "invalid command: $command" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_imported $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_enabled $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = $enable_state ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $enable_state -eq 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # we're doing a disable--remove hard dependency
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_fs_local_grouping $svc $dep_group
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svcadm $command -s svc:/system/$svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "$svc failed to $command" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $enable_state -eq 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # we just did an enable--create hard dependency
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_fs_local_grouping $svc $dep_group
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "$svc service already ${command}d... skipping"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# This chart summarizes the behavior of the -r and -p sub-options for the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# -e and -d options.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# There are 5 possible states, and 5 transitions out of each state.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# states: (vertical axis)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# -------
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 0: no services enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# C: one or both core services enabled (illegal state)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# R: both core services and RM services enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# P: both core services and PITC service enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# A: all services enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# transitions: (horizontal axis)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# ------------
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# +/-a: enable/disable, respectively, with neither -r nor -p
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# +/-r: enable/disable, respectively, with -r flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# +p: enable with -p flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# The result of the function is the next state after the action has been
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# successfully performed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# +a | -a | +r | -r | +p |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# ++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# ++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# 0 || A | 0* | R | 0* | P |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# --++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# C || A* | 0* | R | 0 | P |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# --++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# R || A* | 0* | R* | 0 | A |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# --++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# P || A* | 0* | A* | P* | P* |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# --++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# A || A* | 0 | A* | P | A* |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# --++----+----+----+----+----+
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# *: warning message is displayed, stating that a service is already
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# enabled/disabled.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# enable the SMF services needed for the Availability Suite
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenable_services()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # first, import them if they have not yet been imported
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte import_services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # if neither r_flag nor p_flag is set, enable all services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (( (r_flag | p_flag) == 0 ))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in $SMF_ENABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ! svc_operation $svc enable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # figure out which services are enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # First, make sure both core services are enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in nws_scm nws_sv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (( ${svc}_enabled == 0 )) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! svc_operation $svc enable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((p_flag))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ! svc_operation nws_ii enable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((r_flag))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in nws_rdc nws_rdcsyncd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ! svc_operation $svc enable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# disable the SMF services needed for the Availability Suite
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisable_services()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_device_groups
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? == 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # This flags the shutdown scripts to not check to make sure the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # services' dependents have been disabled. The flag must be removed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # before returning from this function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte no_depend_check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # NB: p_flag is not allowed for disables. II should not be
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # disabled if sndr is enabled. If rdc is not enabled, disabling just
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # II is equivalent to disabling all the remaining services.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # If no flags passed in, just disable everything
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (( r_flag == 0 ))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in $SMF_DISABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ! svc_operation $svc disable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm_no_depend_check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # Now that we've disable the services, lets unload them
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # from the Solaris kernel
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte #
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte modinfo | grep '(nws:' | grep -v "kRPC Stub" | sort -r | cut -d' ' -f1 | xargs -l modunload -i 2>/dev/null
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte modinfo | grep '(nws:' | grep -v "kRPC Stub" | sort -r | cut -d' ' -f1 | xargs -l modunload -i 2>/dev/null
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # we're disabling just rdc. If II is not already enabled,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # we disable core services, as well.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # figure out which services are enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in nws_rdcsyncd nws_rdc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ! svc_operation $svc disable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm_no_depend_check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (( nws_ii_enabled == 0 ))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in nws_sv nws_scm
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((${svc}_enabled)) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! svc_operation $svc disable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm_no_depend_check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rm_no_depend_check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# check if a service has been imported into the repository
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $1: service to check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# returns 1 if it is imported, 0 if it is not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteis_imported()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc=$1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svcprop -q -p general/entity_stability svc:/system/${svc}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# import the SMF services into the repository, if necessary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteimport_services()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in $SMF_ENABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte import_service $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# check to see if an SMF service is in the repository. If it is not,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# import it in.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $1: name of service to import
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteimport_service()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $xopt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeset svc=$1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte is_imported $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ -f $PKG_INSTALL_ROOT/$MANIFEST_PATH/$svc.xml ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svccfg import $PKG_INSTALL_ROOT/$MANIFEST_PATH/$svc.xml
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $OS_MINOR -lt 11 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # workaround for 6221374--let local-fs know
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # that it depends on us.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte svcadm refresh ${FS_LOCAL_SVC}:default
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## MAIN ######################################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# getopt processing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenable=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisable=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteset_location=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_info=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forter_flag=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortep_flag=0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewhile getopts "xedsirp" opt 2>/dev/null
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case $opt in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte \?)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte help
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte e)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enable=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte d)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disable=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte x)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xopt="set -x"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set -x
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte s)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_location=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte get_info=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte r)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte r_flag=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p_flag=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ;;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte esac
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedone
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# at most one option (besides -x) may be specified at a time
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteoptions_count=$((enable + disable + set_location + get_info))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteif [ $options_count -gt 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte help
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelif [ $options_count = 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NO_ARGS=1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteif (( ((r_flag + p_flag) > 0) && ((enable | disable) == 0) ))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "-r and -p options may only be used with -d or -e options" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelif (( p_flag && disable ))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "The -p option may not be used with the -d option" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# set all the system information variables
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteget_system_state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# if we're enabling, we need to make sure we have a valid dscfg out there.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteif [ $enable = 1 -a $VALID_LOCAL_DB != 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Cannot find a valid configuration database" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteif [ $NO_ARGS = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # only initialize the database if necessary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_LOCAL_DB = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "Local configuration database is already initialized."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initialize_local_db
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $CLUSTER_CONFIGURED = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $VALID_CLUSTER_DB = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "Cluster configuration database is already "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "initialized.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # ask the user for a cluster database location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_cluster_config
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # initialize the new db
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initialize_cluster_db
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # make sure that the local filesystem dependency type is correct
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for svc in $SMF_ENABLE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_fs_local_grouping $svc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # NOTE: check_fs_local_grouping sets CORRECT_GROUPING
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # To avoid this issue in the future, always administer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # the services using dscfgadm.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "Warning: Fixing dependency for $svc.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_fs_local_grouping $svc $CORRECT_GROUPING
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? -ne 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # give the user the chance to startup AVS services, if not started
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte check_enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $OLD_VALID_LOCAL_DB = 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "WARNING: AVS services are running on a system "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte printf "which had no valid configuration\ndatabase\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte show_enabled
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ask_to_enable
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? = 1 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enable_services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelif [ $enable = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enable_services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelif [ $disable = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disable_services
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelif [ $get_info = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelif [ $set_location = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortethen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $CLUSTER_CONFIGURED = 1 ]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # ask the user for a cluster database location
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_cluster_config
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte # initialize the new db
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initialize_cluster_db
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if [ $? != 0 ]; then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "$PROG -s is only available on Sun Cluster OE systems" >&2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefi
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortereturn 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte########################## MAIN ######################################
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte