~ubuntu-branches/ubuntu/warty/openafs/warty

« back to all changes in this revision

Viewing changes to src/afsd/afs.rc.darwin

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-01-10 16:37:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040110163733-jvr0n1uahshlb1uu
Tags: upstream-1.2.11
ImportĀ upstreamĀ versionĀ 1.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright 2000, International Business Machines Corporation and others.
 
3
# All Rights Reserved.
 
4
 
5
# This software has been released under the terms of the IBM Public
 
6
# License.  For details, see the LICENSE file in the top-level source
 
7
# directory or online at http://www.openafs.org/dl/license10.html
 
8
#
 
9
# Portions Copyright (c) 2003 Apple Computer, Inc.
 
10
 
 
11
. /etc/rc.common
 
12
 
 
13
CheckForNetwork 
 
14
 
 
15
if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
 
16
 
 
17
if [ -r /var/db/openafs ]; then
 
18
   VICEETC=/var/db/openafs/etc
 
19
   AFSD=/usr/sbin/afsd
 
20
else
 
21
   VICEETC=/usr/vice/etc
 
22
   AFSD=$VICEETC/afsd
 
23
fi
 
24
CONFIG=$VICEETC/config
 
25
AFSDOPT=$CONFIG/afsd.options
 
26
PACKAGE=$CONFIG/package.options
 
27
 
 
28
LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
 
29
MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
 
30
SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
 
31
 
 
32
if [ -f $AFSDOPT ]; then
 
33
    OPTIONS=`cat $AFSDOPT`
 
34
else
 
35
    OPTIONS="$MEDIUM -fakestat"
 
36
fi
 
37
 
 
38
if [ -x /usr/sbin/kmodstat ]; then
 
39
   KMODSTAT=/usr/sbin/kmodstat
 
40
else
 
41
  if [ -x /usr/sbin/kextstat ]; then
 
42
     KMODSTAT=/usr/sbin/kextstat
 
43
fi
 
44
fi
 
45
 
 
46
# Need the commands ps, awk, kill, sleep
 
47
PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
 
48
if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then
 
49
:
 
50
else
 
51
if [ -d $VICEETC/afs.kext ]; then
 
52
        echo "Loading AFS kernel extensions"
 
53
        kextload $VICEETC/afs.kext
 
54
else
 
55
        echo "$VICEETC/afs.kext does not exist. Skipping AFS startup."
 
56
        exit 1
 
57
fi
 
58
fi
 
59
if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then
 
60
:
 
61
else
 
62
        echo "AFS kernel extensions failed to initialize. Skipping AFS startup."
 
63
        exit 1
 
64
fi
 
65
 
 
66
#
 
67
# Start the AFS server processes if a bosserver exists
 
68
#
 
69
 
 
70
if [ -x /usr/afs/bin/bosserver ]; then
 
71
        echo "Starting AFS Server processes"
 
72
        /usr/afs/bin/bosserver
 
73
        OPTIONS="$OPTIONS -nosettime"
 
74
        sleep 30
 
75
fi
 
76
 
 
77
#
 
78
# Check that all of the client configuration files exist
 
79
#
 
80
 
 
81
for file in $AFSD $VICEETC/cacheinfo \
 
82
            $VICEETC/ThisCell $VICEETC/CellServDB
 
83
do
 
84
        if [ ! -f ${file} ]; then
 
85
                echo "${file} does not exist. Not starting AFS client."
 
86
                exit 1
 
87
        fi
 
88
done
 
89
 
 
90
#
 
91
# Check that the root directory for AFS (/afs) 
 
92
# and the cache directory (/usr/vice/cache) both exist
 
93
#
 
94
 
 
95
for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo`
 
96
do
 
97
        if [ ! -d ${dir} ]; then
 
98
                echo "${dir} does not exist. Not starting AFS client."
 
99
                exit 2
 
100
        fi
 
101
done
 
102
 
 
103
echo "Starting afsd"
 
104
$AFSD $OPTIONS
 
105
 
 
106
#
 
107
# Call afssettings (if it exists) to set customizable parameters
 
108
#
 
109
if [ -x $VICEETC/config/afssettings ]; then
 
110
    sleep 2
 
111
    $VICEETC/config/afssettings
 
112
fi
 
113
 
 
114
#
 
115
# Run package to update the disk
 
116
#
 
117
if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
 
118
        /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
 
119
case $? in
 
120
0)
 
121
        (echo "Package completed successfully") > /dev/console 2>&1
 
122
        date > /dev/console 2>&1
 
123
        ;;
 
124
4)
 
125
        (echo "Rebooting to restart system") > /dev/console 2>&1
 
126
        sync
 
127
        /sbin/reboot
 
128
        ;;
 
129
*)
 
130
        (echo "Package update failed; continuing") > /dev/console 2>&1
 
131
        ;;
 
132
esac
 
133
 
 
134
fi
 
135
 
 
136
#
 
137
# Start AFS inetd services
 
138
# (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
 
139
#
 
140
if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
 
141
        /usr/sbin/inetd.afs /etc/inetd.conf.afs
 
142
fi