txzonemgr.sh revision f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
#
# This script provides a simple GUI for managing labeled zones.
# It takes no arguments, but provides contextual menus which
# provide appropriate choices. It must be run in the global
# zone as root.
title="Labeled Zone Manager"
maxlabel=`chk_encodings -X 2>/dev/null`
if [[ ! -n $maxlabel ]]; then
fi
if [ $? != 0 ]; then
fi
}
if [ $hexlabel ] ; then
else
label="Select Label...\n"
curlabel=...
fi
}
if [[ -n $filesystem ]]; then
snapshot="Create Snapshot\n"
fi
}
zonelist=""
if [ $q != $zonename ]; then
fi
done
if [[ -n $zonelist ]]; then
fi
}
if [[ -n $macstate ]]; then
permitrelabel="Deny Relabeling\n"
else
permitrelabel="Permit Relabeling\n"
fi
}
labelList=""
if [ $? != 0 ]; then
newlabel=`hextoalabel $p`
fi
done
alabel=$(echo $labelList|zenity --list \
--height=300 \
--width=400 \
if [[ -n $alabel ]]; then
if [[ -n $newlabel ]]; then
else
fi
fi
}
--height=300 \
if [[ -n $image ]]; then
if [[ -n $dataset ]]; then
fi
if [ ! -f /var/ldap/ldap_client_file ]; then
fi
fi
}
--height=300 \
/usr/bin/gnome-terminal \
if [ ! -f /var/ldap/ldap_client_file ]; then
fi
}
if [ $? != 0 ]; then
exit 1
fi
if [ -f /var/ldap/ldap_client_file ]; then
ldapaddress=`ldapclient list | \
profName=`ldapclient list | \
proxyPwd=`ldapclient list | \
proxyDN=`ldapclient list | \
fi
else
fi
if [[ -z $locale ]]; then
locale="C"
fi
}
# if there is a zfs pool for zone
# create a new dataset for the zone
# This step is done automatically by zonecfg
# in Solaris Express 8/06 or newer
if [ $? = 0 ]; then
fi
/usr/bin/gnome-terminal \
}
# if there is an entry for this zone in tnzonecfg, remove it
# before deleting the zone.
if [ -n "${tnzone}" ]; then
fi
}
nics=
do
if [ $? -eq 1 ]; then
continue
fi
i=${i%:} # Remove colon after interface name
if [ $? -eq 0 ]; then
continue
fi
done
}
cidr=
if [ $? != 0 ]; then
return;
fi
}
if [[ -z $nic ]]; then
return;
fi
if [[ -z $ipaddr ]]; then
return;
fi
if [[ -z $cidr ]]; then
return;
fi
zcfg="
add net
set address=${ipaddr}/${cidr}
set physical=$nic
end
commit
"
}
type=ignore
do
case $j in
inet) type=$j;;
zone) type=$j;;
*) continue ;;
esac;\
type=ignore;;
esac
done
if [ $ipaddr != 0.0.0.0 ]; then
else
template="..."
ipaddr="..."
fi
}
if [ $? = 0 ]; then
else
fi
}
if [ $? != 0 ]; then
return;
fi
if [[ -z $ipaddr ]]; then
if [ $? != 0 ]; then
return;
fi
fi
}
# Update hosts and ipnodes
if [[ -z $ipaddr ]]; then
return;
fi
if [ $? -eq 1 ]; then
fi
if [ $? -eq 1 ]; then
fi
}
while [ 1 -gt 0 ]; do
--height=300 \
if [ $? != 0 ]; then
break;
fi
--height=300 \
--width=450 \
if [ $? != 0 ]; then
continue
fi
break
done
}
}
}
zcfg="
set limitpriv=default,win_mac_read,win_mac_write,win_selection,win_dac_read,win_dac_write,file_downgrade_sl,file_upgrade_sl,sys_trans_label
commit
"
}
zcfg="
set limitpriv=default
commit
"
}
if [[ $? -eq 1 ]]; then
zcfg="
add fs
set type=lofs
end
add fs
set type=lofs
end
commit
"
fi
}
while [ 1 -gt 0 ]; do
do
if [ $? -eq 1 ]; then
continue
fi
nic=${i%:} # Remove colon after interface name
done
do
if [ $? -eq 1 ]; then
continue
fi
nic=${i%:} # Remove colon after interface name
done
--height=300 \
--width=450 \
if [[ -z $nic ]]; then
return
fi
# Clear list of commands
# Check for physical interface
if [ $? != 0 ]; then
else
if [ $? != 0 ]; then
unplumb="Remove Logical Interface\n"
bringup="Bring Up\n"
fi
else
bringdown="Bring Down\n"
fi
fi
else
settemplate="View Templates...\n"
share="Share\n"
fi
fi
command=$(echo ""\
$share \
$unplumb \
$bringup \
--height=300 \
" Create Logical Interface")\
" Set IP address...")\
addHost;;
" Share")\
" View Templates...")\
" Remove Logical Interface")\
" Bring Up")\
" Bring Down")\
*) continue;;
esac
done
}
# Main loop for top-level window
#
# Always display vni0 since it is useful for cross-zone networking
#
if [ $? != 0 ]; then
fi
while [ "${command}" != Exit ]; do
if [[ ! -n $zonename ]]; then
zonelist=""
done
zonelist="${zonelist}Create a new zone...\n\n\nManage Network Interfaces...\n\n"
--height=300 \
--width=500 \
)
if [[ ! -n $zonename ]]; then
exit
fi
if [ "$zonename" = "Manage Network Interfaces..." ]; then
continue
elif [ "$zonename" = "Create a new zone..." ]; then
if [[ ! -n $zonename ]]; then
continue
fi
zcfg="
create -t SUNWtsoldef
set zonepath=/zone/$zonename
commit
"
fi
fi
# Clear list of commands
stop=
copy=
delay=0
case $zonestate in
reboot="Reboot\n"; \
stop="Halt\n"; \
;;
stop="Halt\n" \
;;
if [[ -z $label ]]; then \
ready="Ready\n"; \
start="Boot\n"; \
fi; \
uninstall="Uninstall\n"; \
addnet="Add Network...\n"
;;
copyCheck; \
delete="Delete\n"; \
console=; \
;;
;;
*)
;;
esac
command=$(echo ""\
$console \
$label \
$start \
$reboot \
$stop \
$clone \
$copy \
$install \
$ready \
$delete \
$addnet \
"Select another zone...\n" \
"Exit" \
--height=300 \
" Zone Console...")
delay=2; \
" Select Label...")
" Ready")
" Boot")
" Halt")
" Reboot")
" Install...")
install;;
" Clone")
clone ;;
" Copy...")
copy ;;
" Uninstall")
" Delete")
delete ;;
" Create Snapshot")
" Add Network...")
addNet ;;
" Permit Relabeling")
setMacPrivs ;;
" Deny Relabeling")
" Select another zone...")
zonename= ;;
*)
exit ;;
esac
done