4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
22 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
26 typeset
-r PROG
=$
(basename $0)
27 typeset
-r CTAG_NULL
="-"
45 if [ $CLUSTER_CONFIGURED -eq 1 ]; then
51 -i : display information on the Availability Suite services
52 -e : enable Availability Suite services (all, by default)
53 -d : disable Availability Suite services (all, by default)
54 -r : enable/disable Remote Mirror
55 -p : enable Point in Time Copy" >&2
56 if [ $CLUSTER_CONFIGURED -eq 1 ]; then
58 -s : set the location of the cluster configuration database" >&2
61 -x : turn on script debugging (may be used with any valid option)
63 When executed with no options or with nothing but -x, $PROG runs in
64 interactive fashion, allowing the user to initialize the local (and
65 if applicable, the cluster) configuration database, and to start the
66 Availability Suite services." >&2
71 ########################## SET GLOBAL VARIABLES ######################
75 export PKG_INSTALL_ROOT
78 LD_LIBRARY_PATH
=/usr
/lib
:/usr
/lib
79 export LD_LIBRARY_PATH
82 DSCFG
="/usr/sbin/dscfg"
85 # set parser config location
86 PCONFIG
="/etc/dscfg_format"
89 # set local dscfg location
90 export LOCAL_DSCFG
="/etc/dscfg_local"
92 # set cluster dscfg reference file
93 export CLUSTER_REF
="/etc/dscfg_cluster"
95 # a service that has a dependency on us
96 FS_LOCAL_SVC
="svc:/system/filesystem/local"
98 NODELIST
="/tmp/nodelist"
99 DSCFGLOCKDCF
="/etc/dscfg_lockdb"
100 DSCFG_DEPEND_NOCHK
="/tmp/.dscfgadm_pid"
103 MANIFEST_PATH
=/lib
/svc
/manifest
/system
105 # SMF services (enable and disable)
106 SMF_ENABLE
="nws_scm nws_sv nws_ii nws_rdc nws_rdcsyncd"
107 SMF_DISABLE
="nws_rdcsyncd nws_rdc nws_ii nws_sv nws_scm"
109 # state of each service
114 nws_rdcsyncd_enabled
=0
117 PATH
=/usr
/bin
:/usr
/sbin
:/sbin
/sh
123 OS_MINOR
=`uname -r | cut -d '.' -f2`
125 # number of sectors required for database
129 # must set here, else seen as null in MAIN
137 # set lengthy message here
138 CLUST_LOC_MESS
="The current location is invalid for a Sun StorageTek \
139 Data Services configuration database. Once a valid location is \
140 entered (raw slice on \"did\" device), you may upgrade the existing \
141 database to this new location - following the procedure outlined \
142 in the Installation and Configuration Guide."
144 ########################## SET GLOBAL VARIABLES ######################
147 ########################## ERROR ####################################
149 # called with optional error msg $1
150 # prints basic guidelines for configuration of the database location
156 echo "INSTALLATION ERROR" >&2
161 if [ $?
-eq 1 ]; then
162 echo "GENERAL INSTALLATION RULES:" >&2
163 echo "\tBecause you are installing on a cluster," >&2
164 echo "\tthe database must be located on a raw slice of a did device.">&2
165 echo "\t e.g. /dev/did/rdsk/d17s1" >&2
168 MB
=`expr $REQUIRED / 2 / 1024`
169 echo "\t$REQUIRED sectors ($MB MBs) are required for the database." >&2
172 ########################## ERROR ####################################
174 ########################## ALL LOCATION TESTS ########################
176 # sets numerous environment variables describing the state of the system
181 valid_local_dscfg_exists
183 OLD_VALID_LOCAL_DB
=$VALID_LOCAL_DB
189 CLUSTER_CONFIGURED
=$?
191 if [ $IN_CLUSTER = 1 ]; then
192 valid_cluster_dscfg_exists
194 OLD_VALID_CLUSTER_DB
=$VALID_CLUSTER_DB
200 # Checks if in cluster
201 # returns 1 if in cluster, else 0
207 if [ -x /usr
/sbin
/clinfo
]; then
209 if [ $?
-eq 0 ]; then
219 # checks if a system is configured as a cluster
220 # returns 1 if configured as a cluster, 0 if not
226 if [ -f /etc
/cluster
/nodeid
]; then
233 # Check the list of Sun Cluster device groups known in the dscfg, determing
234 # if they are currently enabled on this Sun Cluster node. If so, fail allowing
235 # the system administator to scswitch them elsewhere.
237 check_device_groups
()
241 if [ $VALID_CLUSTER_DB == 1 ]; then
242 DEVICE_GROUPS
=`$DSCFG -s $FILE_LOC -l 2>/dev/null | \
243 grep "^dsvol:" | cut -d' ' -f3 | sort | uniq | xargs`
244 for x
in $DEVICE_GROUPS
246 $DSCFG -D $x 2>/dev
/null
255 print
"The following Sun Cluster device groups are in use "
256 print
"by Availability Suite on this node."
260 print
"'scswitch' them to another Sun Cluster node before "
261 print
"attempting to disable any data services."
271 # checks to see if this is a char device in the
272 # /dev/did/rdsk directory returns 1 if so.
278 DID
=`echo $1 | awk -F/ '{print $3}'`
279 RDSK
=`echo $1 | awk -F/ '{print $4}'`
281 if [ "did" = $DID -a "rdsk" = $RDSK -a -c $1 ]; then
289 # checks size of area for db location
295 # if in cluster look for d*s*
296 SLICE
=`echo $1 | sed -n 's/.*d.*s\(.*\)/\1/p'`
298 SECTORS
=`prtvtoc $1 | tr -s ' '| grep "^ $SLICE " | awk '{print $5}'`
300 if [ -z "$SECTORS" ]; then
301 echo "SLICE at $1 not found on this device"
305 # if required size is greater than space available, then fail
306 if [ $REQUIRED -gt $SECTORS ]; then
313 # looks in dscfg_cluster reference file. if a location is configured,
314 # tests to see if it is a valid database. if so, returns 1
316 valid_cluster_dscfg_exists
()
320 if [ -s $CLUSTER_REF ]; then
321 FILE_LOC
=`head -1 $CLUSTER_REF`
322 contains_data
$FILE_LOC
330 # checks for the existence of dscfg_local database, and if it exists,
331 # tests to see if it is a valid database. if so, returns 1
333 valid_local_dscfg_exists
()
337 if [ -s $LOCAL_DSCFG ]; then
338 contains_data
$LOCAL_DSCFG
345 # used to test if a valid DS config database exists on machine already
346 # MAGIC_STRING is the top line in the config used in v3.1 & v3.2
352 # dscfg distinct strings, varies on the architecture
353 if [ $ARCH = "sparc" ]
356 elif [ $ARCH = "i386" ]
361 # Create a PID unique temporary file
364 # Write the first or 16th block (skipping over VTOC) to
365 # the TMP_FILE, then scan for the presence of the "MAGI"
369 if [ ! -z "$1" ]; then
370 dd if=$1 of
=$TMP_FILE count
=1 iseek
=$offset 2>/dev
/null
371 FILECONTENTS
=`strings $TMP_FILE | head -1 2>/dev/null`
372 if [ `echo $FILECONTENTS | grep -c "$MAGIC_STRING"` -gt 0 ]; then
383 ########################## ALL LOCATION TESTS ########################
386 ########################## MAIN FUNCTIONS ############################
388 # since location already has been set, asks what to do now? keeping
389 # it still checks the size (since an upgrade from 3.0 may still be
390 # occuring) and also checks if was an old cluster config on disallowed
391 # /dev/did/dsk directory
394 # 0 if cluster location is invalid or the user does not want to keep it
395 # 1 if the location is valid and the user wants to keep it.
401 NOTE
="\nThe Sun StorageTek Data Services database configuration"
402 NOTE
="$NOTE location has already been set."
405 echo "\nCurrent location: $PKG_INSTALL_ROOT$FILE_LOC"
407 QUEST
="Would you like to preserve the existing configuration"
408 QUEST
="$QUEST information at its current location? "
410 ANS
=`ckyorn -Qd n -p "$QUEST"`
414 #Since the user has said "yes I want to keep this current one"
415 #it may actually be a 3.x database, which only required 4.5mb
416 #space, so now will check that there is room to grow another 1mb"
417 check_location
$FILE_LOC
419 error
"$CLUST_LOC_MESS"
422 OLD_FILE_LOC
=$FILE_LOC
434 # asks if user wants to keep existing db information, overwrite with
435 # a new db, or view the contents, and be asked again...
437 # 0 if old location is bad
438 # 1 if old location is good
440 preserve_overwrite_maybe
()
444 echo "\nIt appears a valid database configuration exists here already."
450 echo "\nWould you like to preserve this information and continue?"
451 echo "\ty - preserve current configuration"
452 echo "\tn - overwrite with new configuration"
453 echo "\tmaybe - view contents of current configuration"
455 ANS
=`ckkeywd -Q y n maybe`
458 check_location
$FILE_LOC
460 error
"$CLUST_LOC_MESS"
463 $DSCFG -s "$FILE_LOC" -C $CTAG_NULL >/dev
/null
2>&1
464 OLD_FILE_LOC
=$FILE_LOC
470 check_location
$FILE_LOC
472 error
"$CLUST_LOC_MESS"
480 # print contents of this db config.
481 echo "\nContents of database configuration found at $SAFE_LOC are:"
482 $DSCFG -l -s "$FILE_LOC" |
more
490 # gets location from user
496 #Checks for absolute path name, and if file name and file doesn't
498 echo "\n\n----------ENTER DATABASE CONFIGURATION LOCATION-----------------"
499 echo "Note: Please ensure this location meets all requirements specified"
500 echo "in the Availability Suite Installation Guide."
502 FILE_LOC
=`ckpath -artwQ -p "Enter location:"`
508 # allow non-root user to access for least privileges
514 # tests for proper config
527 did_clust_msg
="You are in cluster and $LOCATION is not valid DID device"
529 # Set "actual file location" variable here to equal file location
530 # entered by user because getting here means contains_data was already
531 # successfully called before and now the two can equal each other for
536 if [ $IN_CLUSTER = 1 -o $CLUSTER_CONFIGURED = 1 ]; then
537 if [ -b "$LOCATION" ] ||
[ -c "$LOCATION" ]; then
538 is_did_device
$LOCATION
540 error
"$did_clust_msg"
544 error
"$did_clust_msg"
548 echo "Location may not be changed in a non Sun Cluster OE." 2>&1
555 error
"$LOCATION does not meet minimum space requirement."
563 # Notifies the user that the SMF services are online,
564 # and gives him the option to disable the services before proceeding. If
565 # the services are not disabled, the program cannot proceed with setting
566 # a new dscfg location.
573 \nYour services must be disabled before a new configuration location is set.\n"
575 QUEST
="Would you like to disable the services now and continue with the"
576 QUEST
="$QUEST Availability Suite setup? "
578 ANS
=`ckyorn -Qd n -p "$QUEST"`
591 # Asks the user if he would like to enable the services now. If so,
592 # import them (if necessary) and enable them.
599 \nIf you would like to start using the Availability Suite immediately, you may
600 start the SMF services now. You may also choose to start the services later
601 using the $PROG -e command."
603 QUEST
="Would you like to start the services now? "
605 ANS
=`ckyorn -Qd n -p "$QUEST"`
618 # display information about the system
624 typeset grp_error_flg
=0
625 typeset
-L15 svc state en SVC
="SERVICE" STATE
="STATE" EN
="ENABLED"
626 echo "$SVC\t$STATE\t$EN"
633 state
=`svcprop -c -p restarter/state \
634 svc:/system/${i}:default`
635 en
=`svcprop -c -p general/enabled \
636 svc:/system/${i}:default`
637 check_fs_local_grouping
$i
641 grp_error_flg
=$
((grp_error_flg
+ 1))
646 echo "$svc\t$state\t$en"
650 print
"\nAvailability Suite Configuration:"
651 printf "Local configuration database: "
652 if [ $VALID_LOCAL_DB = 1 ]
659 if [ $CLUSTER_CONFIGURED = 1 ]
661 printf "cluster configuration database: "
662 if [ $VALID_CLUSTER_DB = 1 ]
665 print
"cluster configuration location: ${FILE_LOC}"
671 if [ $grp_error_flg -gt 0 ]
675 if [ $grp_error_flg -gt 1 ]
684 printf "\n*** Warning: The service$p above $p_has an incorrect "
685 printf "dependency. To repair the\n"
686 printf "problem, run \"dscfgadm\".\n"
691 # initialize the local configuration database (only called if none exists)
692 # returns 0 if successful, 1 if failed
694 initialize_local_db
()
698 echo "Could not find a valid local configuration database."
699 echo "Initializing local configuration database..."
700 echo y |
${DSCFG} -i > /dev
/null
2>&1
701 ${DSCFG} -i -p ${PCONFIG} > /dev
/null
2>&1
703 # Make sure the new location is initialized properly
704 valid_local_dscfg_exists
706 if [ $VALID_LOCAL_DB != 1 ]
708 echo "Unable to initialize local configuration database" >&2
711 echo "Successfully initialized local configuration database"
718 # initialize the cluster configuration database, if necessary
719 # returns 0 if successful, 1 if failed
721 initialize_cluster_db
()
725 if [ ! -n "$FILE_LOC" ]
730 echo "Initializing cluster configuration database..."
731 ${DSCFG} -s ${FILE_LOC} -C $CTAG_NULL > /dev
/null
2>&1
732 echo y |
${DSCFG} -i -C $CTAG_NULL > /dev
/null
2>&1
733 ${DSCFG} -i -p ${PCONFIG} -C $CTAG_NULL > /dev
/null
2>&1
735 # make sure the cluster db is valid now
736 valid_cluster_dscfg_exists
738 if [ $VALID_CLUSTER_DB != 1 ]
740 echo "Unable to initialize cluster configuration database" >&2
743 echo "Successfully initialized cluster configuration database"
751 # prompt the user for a config location and set AVS to use that location
759 while [ $REPEAT -eq 0 ]; do
760 # See if user has entered location already, and it was an existing
761 # db. Retruns FILE_LOC value
762 if [ $VALID_DB_ENTERED = 1 ]; then
766 preserve_overwrite_maybe
768 # if 1, location passes, and FILE_LOC being passed to end, else
769 # set VALID_CLUSTER_DB to 0 since the "valid one" isn't valid anymore
770 # (bad size, etc) thereby when looping go straight to get_location
780 # if 1, then valid db exists, now see what user wants to do
781 if [ $VALID_CLUSTER_DB = 1 ]; then
785 # if 0, then user can't or won't keep location. set PROMPT
786 # so we will get new location from user.
794 # if either are 0, then user wants or needs new db as outlined in
796 if [ $VALID_CLUSTER_DB = 0 ] ||
[ $PROMPT = 0 ]; then
798 # We cannot proceed if the services are running. Give the user
799 # a chance to stop the services. If he chooses not to, bail.
808 echo "A new configuration location was not set."
821 contains_data
$FILE_LOC
823 # if 1, then user entered an existsing db location, loop
824 # back to ask what to do with it
829 check_location
$FILE_LOC
831 # if 0, that means location has failed, loop and
837 # entered location passes tests
842 # user wants to leave location where and how it is
843 # FILE_LOC being passed all the way to end
851 ########################## MAIN FUNCTIONS ############################
853 ######################## SMF HELPER FUNCTIONS ########################
855 # check if any SMF service is online (enabled)
863 for svc
in $SMF_ENABLE
866 eval ${svc}_enabled
=$?
867 ret
=$
((ret |
${svc}_enabled
))
874 # Display which services are enabled. (Must be called after check_enabled)
881 echo "\nThe following Availability Suite services are enabled:"
883 for svc
in $SMF_ENABLE
885 if (( ${svc}_enabled
== 1 ))
896 # check if the given SMF service is online (enabled)
898 # $1: service name to check for
908 en
=`svcprop -c -p general/enabled svc:/system/${1}:default`
920 # If necessary, flag no dependency check
928 if [ $OS_MINOR -lt 11 ]
930 if [ -f $DSCFG_DEPEND_NOCHK ]
932 pid
=`cat $DSCFG_DEPEND_NOCHK`
933 echo "Another dscfgadm disable is in progress."
934 echo "Waiting for pid: $pid to terminate..."
936 while [ -f $DSCFG_DEPEND_NOCHK ]
938 if (( msg
&& (msg
% 6 == 0)))
940 printf "\nAnother dscfgadm disable "
941 printf "(pid: $pid) still appears to "
942 printf " be in progress.\n"
943 printf "If this is not the case, you "
945 printf "$DSCFG_DEPEND_NOCHK.\n"
952 touch $DSCFG_DEPEND_NOCHK
953 echo $$
>> $DSCFG_DEPEND_NOCHK
958 # If necessary, remove the no dependency check flag
963 if [ $OS_MINOR -lt 11 ]
965 rm -f $DSCFG_DEPEND_NOCHK
970 # set the filesystem/local dependency type and refresh
973 # $2: either "require_all" or "optional_all"
975 set_fs_local_grouping
()
981 # set proper dependency type for fs-local
982 if [ $svc != nws_rdcsyncd
]; then
983 svccfg
-s $FS_LOCAL_SVC setprop \
984 ${svc}-local-fs/grouping
=$dep_group
987 printf "command failed: svccfg -s $FS_LOCAL_SVC "
988 printf "setprop ${svc}-local-fs/grouping=$dep_group "
993 # we need local-fs to know about the new grouping attributes
994 svcadm refresh
${FS_LOCAL_SVC}:default
997 print
"Failed to refresh ${FS_LOCAL_SVC} >&2"
1006 # check if the grouping dependency type for filesystem/local is correct
1012 # 0 if the setting is correct
1013 # 1 if the setting is incorrect
1014 # outputs: sets CORRECT_GROUPING with the value of what the grouping should be.
1016 check_fs_local_grouping
()
1020 typeset cur_grouping
1022 if [ $svc = nws_rdcsyncd
]
1027 # If it's not imported, we just return success, since we don't want
1028 # further processing
1035 # get the current grouping value from the repository
1036 cur_grouping
=`svcprop -c -p ${svc}-local-fs/grouping $FS_LOCAL_SVC`
1038 # Figure out what the grouping should be (based on enabled status)
1042 CORRECT_GROUPING
="require_all"
1044 CORRECT_GROUPING
="optional_all"
1047 if [ "$cur_grouping" != "$CORRECT_GROUPING" ]
1049 # grouping is incorrect
1052 # grouping is just fine
1058 # enable/disable the given SMF service. Also, update the filesystem-local
1059 # dependency, if appropriate.
1061 # $1: service name to check for
1062 # $2: "enable" or "disable"
1069 typeset enable_state
1072 # If disabling, then enable_state better be true, and we are
1073 # transitioning to "option_all" grouping
1074 if [ $command = "disable" ]
1077 dep_group
="optional_all"
1079 # If enabling, then enable_state better be false, and we are
1080 # transitioning to "require_all" grouping
1081 elif [ $command = "enable" ]
1084 dep_group
="require_all"
1086 echo "invalid command: $command" >&2
1093 if [ $?
= $enable_state ]
1095 if [ $enable_state -eq 1 ]
1097 # we're doing a disable--remove hard dependency
1098 set_fs_local_grouping
$svc $dep_group
1105 svcadm
$command -s svc
:/system
/$svc
1108 echo "$svc failed to $command" >&2
1112 if [ $enable_state -eq 0 ]
1114 # we just did an enable--create hard dependency
1115 set_fs_local_grouping
$svc $dep_group
1123 echo "$svc service already ${command}d... skipping"
1131 # This chart summarizes the behavior of the -r and -p sub-options for the
1132 # -e and -d options.
1133 # There are 5 possible states, and 5 transitions out of each state.
1135 # states: (vertical axis)
1137 # 0: no services enabled
1138 # C: one or both core services enabled (illegal state)
1139 # R: both core services and RM services enabled
1140 # P: both core services and PITC service enabled
1141 # A: all services enabled
1143 # transitions: (horizontal axis)
1145 # +/-a: enable/disable, respectively, with neither -r nor -p
1146 # +/-r: enable/disable, respectively, with -r flag
1147 # +p: enable with -p flag
1149 # The result of the function is the next state after the action has been
1150 # successfully performed.
1152 # +a | -a | +r | -r | +p |
1153 # ++----+----+----+----+----+
1154 # ++----+----+----+----+----+
1155 # 0 || A | 0* | R | 0* | P |
1156 # --++----+----+----+----+----+
1157 # C || A* | 0* | R | 0 | P |
1158 # --++----+----+----+----+----+
1159 # R || A* | 0* | R* | 0 | A |
1160 # --++----+----+----+----+----+
1161 # P || A* | 0* | A* | P* | P* |
1162 # --++----+----+----+----+----+
1163 # A || A* | 0 | A* | P | A* |
1164 # --++----+----+----+----+----+
1166 # *: warning message is displayed, stating that a service is already
1170 # enable the SMF services needed for the Availability Suite
1177 # first, import them if they have not yet been imported
1180 # if neither r_flag nor p_flag is set, enable all services
1181 if (( (r_flag | p_flag
) == 0 ))
1183 for svc
in $SMF_ENABLE
1185 if ! svc_operation
$svc enable
1191 # figure out which services are enabled
1194 # First, make sure both core services are enabled
1195 for svc
in nws_scm nws_sv
1197 if (( ${svc}_enabled
== 0 )) && \
1198 ! svc_operation
$svc enable
1206 if ! svc_operation nws_ii
enable
1214 for svc
in nws_rdc nws_rdcsyncd
1216 if ! svc_operation
$svc enable
1229 # disable the SMF services needed for the Availability Suite
1242 # This flags the shutdown scripts to not check to make sure the
1243 # services' dependents have been disabled. The flag must be removed
1244 # before returning from this function.
1247 # NB: p_flag is not allowed for disables. II should not be
1248 # disabled if sndr is enabled. If rdc is not enabled, disabling just
1249 # II is equivalent to disabling all the remaining services.
1251 # If no flags passed in, just disable everything
1252 if (( r_flag
== 0 ))
1254 for svc
in $SMF_DISABLE
1256 if ! svc_operation
$svc disable
1263 # Now that we've disable the services, lets unload them
1264 # from the Solaris kernel
1266 modinfo |
grep '(nws:' |
grep -v "kRPC Stub" |
sort -r | cut
-d' ' -f1 |
xargs -l modunload
-i 2>/dev
/null
1267 modinfo |
grep '(nws:' |
grep -v "kRPC Stub" |
sort -r | cut
-d' ' -f1 |
xargs -l modunload
-i 2>/dev
/null
1269 # we're disabling just rdc. If II is not already enabled,
1270 # we disable core services, as well.
1272 # figure out which services are enabled
1275 for svc
in nws_rdcsyncd nws_rdc
1277 if ! svc_operation
$svc disable
1284 if (( nws_ii_enabled
== 0 ))
1286 for svc
in nws_sv nws_scm
1288 if ((${svc}_enabled
)) && \
1289 ! svc_operation
$svc disable
1304 # check if a service has been imported into the repository
1305 # $1: service to check
1306 # returns 1 if it is imported, 0 if it is not
1314 svcprop
-q -p general
/entity_stability svc
:/system
/${svc}
1324 # import the SMF services into the repository, if necessary
1331 for svc
in $SMF_ENABLE
1338 # check to see if an SMF service is in the repository. If it is not,
1340 # $1: name of service to import
1350 if [ -f $PKG_INSTALL_ROOT/$MANIFEST_PATH/$svc.xml
]
1352 svccfg import
$PKG_INSTALL_ROOT/$MANIFEST_PATH/$svc.xml
1354 if [ $OS_MINOR -lt 11 ]
1356 # workaround for 6221374--let local-fs know
1357 # that it depends on us.
1358 svcadm refresh
${FS_LOCAL_SVC}:default
1365 ########################## MAIN ######################################
1374 while getopts "xedsirp" opt
2>/dev
/null
1405 # at most one option (besides -x) may be specified at a time
1406 options_count
=$
((enable + disable
+ set_location
+ get_info
))
1407 if [ $options_count -gt 1 ]
1410 elif [ $options_count = 0 ]
1415 if (( ((r_flag
+ p_flag
) > 0) && ((enable | disable
) == 0) ))
1417 echo "-r and -p options may only be used with -d or -e options" >&2
1419 elif (( p_flag
&& disable
))
1421 echo "The -p option may not be used with the -d option" >&2
1427 # set all the system information variables
1430 # if we're enabling, we need to make sure we have a valid dscfg out there.
1431 if [ $enable = 1 -a $VALID_LOCAL_DB != 1 ]
1433 echo "Cannot find a valid configuration database" >&2
1440 # only initialize the database if necessary
1441 if [ $VALID_LOCAL_DB = 1 ]; then
1442 echo "Local configuration database is already initialized."
1445 if [ $?
!= 0 ]; then
1450 if [ $CLUSTER_CONFIGURED = 1 ]
1452 if [ $VALID_CLUSTER_DB = 1 ]; then
1453 printf "Cluster configuration database is already "
1454 printf "initialized.\n"
1456 # ask the user for a cluster database location
1459 # initialize the new db
1460 initialize_cluster_db
1461 if [ $?
!= 0 ]; then
1468 # make sure that the local filesystem dependency type is correct
1469 for svc
in $SMF_ENABLE
1471 check_fs_local_grouping
$svc
1474 # NOTE: check_fs_local_grouping sets CORRECT_GROUPING
1475 # To avoid this issue in the future, always administer
1476 # the services using dscfgadm.
1477 printf "Warning: Fixing dependency for $svc.\n"
1478 set_fs_local_grouping
$svc $CORRECT_GROUPING
1486 # give the user the chance to startup AVS services, if not started
1489 if [ $OLD_VALID_LOCAL_DB = 0 ]; then
1490 printf "WARNING: AVS services are running on a system "
1491 printf "which had no valid configuration\ndatabase\n"
1505 elif [ $enable = 1 ]
1513 elif [ $disable = 1 ]
1521 elif [ $get_info = 1 ]
1525 elif [ $set_location = 1 ]
1527 if [ $CLUSTER_CONFIGURED = 1 ]
1529 # ask the user for a cluster database location
1532 # initialize the new db
1533 initialize_cluster_db
1534 if [ $?
!= 0 ]; then
1538 echo "$PROG -s is only available on Sun Cluster OE systems" >&2
1546 ########################## MAIN ######################################