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.
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.
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]
22 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
25 #ident "%Z%%M% %I% %E% SMI"
29 # This script installs zones by cloning a zfs snapshot.
30 # For each sensitivity label dominated by the clearance
31 # a zone is installed if necessary. If the zone name is
32 # not already defined in tnzonecfg, the user is prompted
33 # to provide a unique zone name.
35 # $1 is the label upper bound (clearance)
37 # $2 is the zone snaphot to clone for a new zone
39 ZONECFG
=/etc
/security
/tsol
/tnzonecfg
50 echo "create -F -t SUNWtsoldef" > $config
51 echo "set zonepath=/zone/$zonename" >> $config
52 echo "commit" >> $config
53 /usr
/sbin
/zonecfg
-z $zonename -f $config
63 echo Cloning
$zonename from
$image ...
64 found
=`zoneadm -z $zonename list -p 2>/dev/null`
68 echo "$zonename is being configured."
71 /usr
/sbin
/zfs clone
$image zone
/$zonename
72 /usr
/sbin
/zoneadm
-z $zonename attach
-F
76 # Create missing zones for each label dominated by clearance
79 for label
in `lslabels -h "$clearance"`; do
80 zonename
=`/bin/grep $label: $ZONECFG | cut -d ":" -f1`
81 if [ $zonename ]; then
82 state
=`zoneadm -z $zonename list -p 2>/dev/null | cut -d ":" -f3`
84 if [ $state != configured
]; then
85 echo $zonename is already installed.
90 zonelabel
=`hextoalabel $label`
91 echo Enter zone name
for $zonelabel
92 echo or RETURN to skip this label
:
94 if [ $zonename ]; then
95 nz
=`/bin/grep "^$zonename:" $ZONECFG | cut -d ":" -f1`
97 echo $zonename is already used
for another label.
99 echo "$zonename:$label:0::" >> $ZONECFG
102 echo Skipping zone
for $zonelabel