xref: /illumos-gate/usr/src/cmd/fs.d/nfs/svc/nlockmgr (revision f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01)
1#!/sbin/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# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#ident	"%Z%%M%	%I%	%E% SMI"
27
28#
29# Start the lockd service; we are serving NFS and we need to verify
30# that rpcbind is accepting traffic from the network.
31#
32
33BIND_FMRI=svc:/network/rpc/bind
34do_change=false
35if set -- `svcprop -t -p config/local_only $BIND_FMRI`; then
36	if [ "$2" != boolean ]; then
37		echo "$0: config/local_only property for $BIND_FMRI has wrong "\
38		    "type" 1>&2
39	elif [ "$#" -ne 3 ]; then
40		echo "$0: config/local_only property for $BIND_FMRI has wrong "\
41		    "number of values" 1>&2
42	elif [ "$3" = true ]; then
43		do_change=true
44	fi
45else
46	# If the property is not found, we just set it.
47	do_change=true
48fi
49
50if $do_change
51then
52	# These will generate errors in the log.
53	svccfg -s $BIND_FMRI setprop config/local_only = boolean: false
54	if [ $? != 0 ]; then
55		echo "$0: WARNING setprop failed" 1>&2
56	fi
57
58	svcadm refresh $BIND_FMRI
59	if [ $? != 0 ]; then
60		echo "$0: WARNING svcadm refresh failed" 1>&2
61	fi
62fi
63
64exec /usr/lib/nfs/lockd
65