1# vim: filetype=sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27# Variables we'll use to name our zones 28# The first two zones are created by setup, 29# then destroyed in zones_004_pos - or cleanup. 30ZONE="${ZONE:=zone}" 31ZONE2="${ZONE2:=zonetwo}" 32 33# These zones are created and destroyed by zones_003_pos - or cleanup. 34ZONE3="${ZONE3:=zonethree}" 35ZONE4="${ZONE4:=zonefour}" 36 37# A function which runs through a loop, adding a different characters 38# to the stem passed as $1, to make sure we have a unique name that 39# doesn't clash with an existing zone name. Once we've found a unique 40# name, we echo that to stdout. 41# 42function find_unique_zonename { # initial name of zone 43 44 NAME=$1 45 COUNT=0 46 while [ -z "$FOUND" ] 47 do 48 NAME="${NAME}${COUNT}" 49 $ZONEADM -z $NAME list > /dev/null 2>&1 50 if [ $? -eq 1 ] 51 then 52 FOUND=true 53 fi 54 COUNT=$(( $COUNT + 1 )) 55 done 56 echo $NAME 57} 58 59# Need a longer timeout for zone installation 60export STF_TIMEOUT=3600 61 62# Make sure that multiple sourcing of this script doesn't change the zone name 63if [ -z "${RUNCONFIG}" ] 64then 65 ZONE=$(find_unique_zonename $ZONE) 66 ZONE2=$(find_unique_zonename $ZONE2) 67 ZONE3=$(find_unique_zonename $ZONE3) 68 ZONE4=$(find_unique_zonename $ZONE4) 69 70 log_note "zones.cfg gave us new zone names $ZONE,$ZONE2,$ZONE3,$ZONE4" 71 72 export ZONE 73 export ZONE2 74 export ZONE3 75 export ZONE4 76 77 export RUNCONFIG="true" 78fi 79