svc-volfs revision 4610e4a00999c6d2291b3fc263926b890ec500a5
#!/sbin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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
# or http://www.opensolaris.org/os/licensing.
# 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 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
FMRI=svc:/system/filesystem/volfs:default
# For modifying parameters passed to vold, do not edit
# this script. Instead use svccfg(1m) to modify the SMF
# repository. For example:
#
# # svccfg
# svc:> select system/filesystem/volfs
# svc:/system/filesystem/volfs> setprop vold/never_writeback_label= "true"
# svc:/system/filesystem/volfs> exit
#
# refer to vold(1M) man page for additional examples
. /lib/svc/share/smf_include.sh
getpropstring() {
val=`svcprop -c -p $2 $FMRI`
[ -n "$val" ] && [ "$val" != '""' ] && echo $1 $val
}
config_file=/etc/vold.conf
val=`svcprop -c -p vold/config_file $FMRI`
[ -n "$val" ] && [ "$val" != '""' ] && config_file="$val"
if [ ! -f $config_file ]; then
echo "\"$config_file\" does not exist"
exit $SMF_EXIT_ERR_CONFIG
fi
case "$1" in
'start')
# volume management is not supported in a local zone
if [ `/sbin/zonename` != "global" ] ; then
/usr/sbin/svcadm disable -t svc:/system/filesystem/volfs
echo "Volume management is not supported in a local zone"
sleep 5 &
exit $SMF_EXIT_OK
fi
if [ ! -x /usr/sbin/vold ]; then
echo "/usr/sbin/vold is not executable"
exit $SMF_EXIT_ERR_CONFIG
fi
if [ ! -f /dev/volctl ]; then
devfsadm -i vol
fi
args="$args `getpropstring -d vold/root_dir`"
args="$args `getpropstring -l vold/log_file`"
val=`svcprop -c -p vold/log_debuglevel $FMRI`
[ -n "$val" ] && [ "$val" != '0' ] && args="$args -L $val"
[ `svcprop -c -p vold/never_writeback_label $FMRI` = "true" ] && args="$args -n"
[ `svcprop -c -p vold/log_nfs_trace $FMRI` = "true" ] && args="$args -t"
[ `svcprop -c -p vold/log_verbose $FMRI` = "true" ] && args="$args -v"
# note that vold is not self-daemonizing and that any service depending
# on vold may need its own mechanism for figuring out whether vold is
# actually fully operational
/usr/sbin/vold $args -f $config_file &
;;
'refresh')
touch $config_file
/usr/bin/pkill -HUP -z global -x vold
;;
*)
echo "Usage: $0 { start | refresh }"
exit $SMF_EXIT_ERR_FATAL
;;
esac
exit $SMF_EXIT_OK