xref: /titanic_44/usr/src/cmd/initpkg/init.d/cachefs.daemon (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
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, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27#ident	"%Z%%M%	%I%	%E% SMI"
28
29# If /usr is a cachefs file system then start up the
30# cachefsd for it and any other cachefs file system.
31
32if [ "x`/usr/lib/fs/cachefs/cfsfstype /usr/lib 2>/dev/null`" != xcachefs ]; then
33	exit 0
34fi
35
36rpcprogram=100235
37rpcvers=1
38cachefsd_fmri="network/rpc-${rpcprogram}_${rpcvers}/rpc_ticotsord:ticotsord"
39cachefsd=/usr/lib/fs/cachefs/cachefsd
40inetconf=/etc/inet/inetd.conf
41svcfound=no
42
43enabled=`/usr/bin/svcprop -p general/enabled $cachefsd_fmri 2>/dev/null`
44if [ $? != 0 ]; then
45	echo "WARNING: cachefs service not present" >& 2
46	exit 1
47fi
48if [ "$enabled" != "true" ]; then
49	echo "WARNING: cachefs service not enabled" >& 2
50	exit 1
51fi
52
53for i in 1 2 3 4 5; do
54	if /usr/bin/rpcinfo -l `/usr/bin/uname -n` $rpcprogram $rpcvers \
55	    2>/dev/null | /usr/bin/grep 100235 >/dev/null 2>&1; then
56		svcfound=yes
57		break
58	fi
59
60	sleep 1
61done
62
63if [ $svcfound = no ]; then
64	echo "WARNING: Timed out waiting for cachefs service to register" >&2
65fi
66
67/usr/lib/fs/cachefs/cfsadmin -C /dev/null 2>/dev/null
68
69/usr/lib/fs/cachefs/cachefspack /usr/lib/fs/cachefs \
70    /etc/netconfig /etc/vfstab /etc/inittab /etc/cachefstab
71