netservices.sh revision e98e14f009b64b4a6ae098a73026d38c985f4f73
#
# 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 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
usage()
{
exit 2
}
#
# set_property fmri group property value
#
# sets the specified property in the specified property-group, creating
# the group and or property if necessary.
#
{
fmri=$1
group=$2
prop=$3
val=$4
if svccfg -s $fmri addpg $group application; then :; else
echo "Failed to create property group \"$group\" \c"
echo "for $fmri."
exit 1
fi
fi
exit 1
fi
}
{
if [ "$1" = "local" ]; then
val=false
else
val=true
fi
}
set_cmsd()
{
svcprop -q $CMSD_FMRI:default || return
if [ "$1" = "local" ]; then
proto="ticlts"
else
proto="udp"
fi
}
{
svcprop -q $BIND_FMRI || return
if [ "$1" = "local" ]; then
val=true
else
val=false
fi
}
svcprop -q $XSERVER_FMRI || return
if [ "$1" = "local" ]; then
val=false
else
val=true
fi
# don't need refresh since x11-server is not an actual service
}
{
svcprop -q $SENDMAIL_FMRI || return
if [ "$1" = "local" ]; then
val=true
else
val=false
fi
}
{
svcprop -q $RFC1179_FMRI:default || return
if [ "$1" = "local" ]; then
else
val=
fi
}
{
svcprop -q $TTDB_FMRI:tcp || return
if [ "$1" = "local" ]; then
else
fi
inetadm -m $TTDB_FMRI:tcp proto="$val"
}
{
svcprop -q $DTLOGIN_FMRI || return
eval args=`svcprop -p dtlogin/args $DTLOGIN_FMRI`
then
else
old_port=-1
fi
if [ "$1" = "local" ]; then
else
# remove '-udpPort 0' argument. Leave intact if port != 0.
fi
fi
}
svcprop -q $WEBCONSOLE_FMRI:console || return
if [ "$1" = "local" ]; then
val=false
else
val=true
fi
}
svcprop -q $SMCWBEM_FMRI:default || return
if [ "$1" = "local" ]; then
val=false
else
val=true
fi
}
if [ $# -ne 1 ]; then
fi
case $1 in
"open")
keyword="open"
;;
"limited")
keyword="local"
;;
*)
;;
esac
exit 1
fi
#
# set services
#
#
# put the new profile into place, and apply it
#
#
# Make the services aware of the new property values
#
then
# need restart since refresh won't reread properties
echo "restarting syslogd"
fi
then
# need restart since refresh won't pick up new command-line
echo "restarting sendmail"
fi
then
# need restart since refresh won't pick up new command-line
echo "restarting wbem"
fi
then
r="y"
if tty -s ; then
printf \
"dtlogin needs to be restarted. Restart now? [Y] "
read r
fi
if [ "$r" = "" -o "$r" = "y" -o "$r" = "Y" ]; then
# Make sure we survive killing dtlogin...
trap "" 15
echo "restarting dtlogin"
else
printf "dtlogin not restarted. "
printf "Restart it to put it in ${keyword}-mode.\n"
fi
fi
fi