From: Russ Allbery Date: Thu, 11 Aug 2005 00:29:20 +0000 (+0000) Subject: * Improve the openafs-client init script. X-Git-Tag: debian/1.3.87-1~16 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=7d0ed8c25afdb998fcc5d44696296669375d08e1;p=packages%2Fo%2Fopenafs.git * Improve the openafs-client init script. - Choose the client options based on the cache size by default. - Move the code to build the options string to the init script from afs.conf so that afs.conf is pure configuration. - Improve the readability of the output on start. - Significantly improve the comments in afs.conf. - Remove the code to set -nosettime as it's now the default. * Move the openafs-client init script and afs.conf file we use into the debian directory rather than patching the upstream version. We've diverged so much that there's no point in continuing to merge changes. --- diff --git a/debian/afs.conf b/debian/afs.conf new file mode 100644 index 000000000..9a49b9d7c --- /dev/null +++ b/debian/afs.conf @@ -0,0 +1,96 @@ +# -*- sh -*- +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +# Configuration information for AFS client. + +# The following options are maintained by debconf. To change them, run +# dpkg-reconfigure openafs-client. +# +# AFS_CLIENT Whether to start the AFS client at boot +# AFS_AFSDB Whether to use AFSDB DNS records to find VLDB servers +# AFS_CRYPT Whether to enable fcrypt encryption +# AFS_DYNROOT Whether to use a dynamic /afs directory +# AFS_FAKESTAT Whether to fake stat data for mount points + +test -f /etc/openafs/afs.conf.client && . /etc/openafs/afs.conf.client + +# Set to "-verbose" for a lot of debugging information from afsd. Only useful +# for debugging as it prints a LOT of information. +VERBOSE= + +# AFS client configuration options. +# +# Here is a (mostly) complete list of flags that afsd accepts and that are +# useful here: +# +# -blocks The number of blocks available in the workstation cache. +# -files The target number of files in the workstation cache (Default: +# 1000). +# -rootvol The name of the root volume to use. +# -stat The number of stat cache entries. +# -hosts List of servers to check for volume location info FOR THE +# HOME CELL. +# -memcache Use an in-memory cache rather than disk. +# -cachedir The base directory for the workstation cache. +# -mountdir The directory on which the AFS is to be mounted. +# -confdir The configuration directory. +# -nosettime Don't keep checking the time to avoid drift (default). +# -settime Keep checking the time to avoid drift. +# -verbose Be chatty. +# -debug Print out additional debugging info. +# -daemons The number of background daemons to start (Default: 2). +# -rmtsys Also fires up an afs remote sys call (e.g. pioctl, setpag) +# support daemon +# -chunksize 2^n is the chunksize to be used (Default: use a kernel +# module default). +# -dcache The number of data cache entries. +# -prealloc Number of preallocated "small" memory blocks +# -waitclose Make close calls always synchronous (slows them down, though) +# -files_per_subdir Number of files per cache subdir (Default: 2048). +# +# The default behavior is to pick one of the following option sets based on +# the size of the AFS cache, as follows: +# +# cache < 128MB $SMALL +# 128MB < cache < 512MB $MEDIUM +# 512MB < cache < 1GB $LARGE +# 1GB < cache < 2GB $XLARGE +# 2GB < cache $XXLARGE +# +# You can override that default behavior by setting OPTIONS below. +XXLARGE="-stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000" +XLARGE="-stat 3600 -dcache 3600 -daemons 5 -volumes 196 -files 50000" +LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128" +MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70" +SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50" + +# The default behavior is to pick one of the above settings as described +# above. You can override this by setting OPTIONS explicitly to either one of +# the above variables or to any set of flags that you prefer. +OPTIONS=AUTOMATIC + +# If you want to prefer particular servers for replicated volumes, you can +# configure that by defining an afs_server_prefs function here and then +# uncommenting the setting of AFS_POST_INIT below. For more information, see +# fs help setserverprefs and fs getserverprefs (for the current values). + +#afs_server_prefs() { +# fs setserverprefs +#} + +# If you want to always run some command after starting OpenAFS, you can put +# it here. Note that you cannot run multiple commands, even combined with && +# or ; or similar shell meta-characters. If you want to run multiple +# commands, define a shell function instead and put the name of the shell +# function here. +AFS_POST_INIT= + +# Uncomment this line if you defined an afs_server_prefs function. (If you +# have other commands that you also want to run, you'll have to put them in +# that function, as you can only run one function.) +#AFS_POST_INIT=afs_server_prefs diff --git a/debian/changelog b/debian/changelog index 3fbcbee0c..81ccfdf93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,16 @@ openafs (1.3.87-1) unstable; urgency=low * New upstream version. * Add support for ppc64, thanks Andreas Jochens. (Closes: #322020) + * Improve the openafs-client init script. + - Choose the client options based on the cache size by default. + - Move the code to build the options string to the init script from + afs.conf so that afs.conf is pure configuration. + - Improve the readability of the output on start. + - Significantly improve the comments in afs.conf. + - Remove the code to set -nosettime as it's now the default. + * Move the openafs-client init script and afs.conf file we use into the + debian directory rather than patching the upstream version. We've + diverged so much that there's no point in continuing to merge changes. * Diagnose unsupported architectures earlier and with a clearer error. * Suppress error messages from a missing kernel version header since they occur normally when doing the regular package build and are just diff --git a/debian/openafs-client.init b/debian/openafs-client.init new file mode 100755 index 000000000..c495ccb44 --- /dev/null +++ b/debian/openafs-client.init @@ -0,0 +1,198 @@ +#! /bin/sh +# Modified by Sam Hartman for Debian +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +# This init script bears little resemblence to the regular upstream init +# script at this point and is therefore maintained as a Debian-specific file. +# The upstream init script assumes Red Hat paths and uses insmod to load the +# module directly rather than using modprobe. + +CACHEINFO=${CACHEINFO:-/etc/openafs/cacheinfo} +MODULEDIR=${MODULEDIR:-/lib/modules/`uname -r`/fs} + +exec 3>/dev/null +exec &2 +AFS module $MODULEDIR/$LIBAFS does not exist. +Not starting AFS. Please consider building kernel modules using +instructions in /usr/share/doc/openafs-client/README.modules +EOF + exit 1 + fi + LOADED=`/sbin/lsmod | fgrep openafs` + if [ -z "$LOADED" ] ; then + modprobe openafs${MP} + status=$? + if [ $status = 0 ] ; then + echo -n " openafs" + fi + return $status + fi + return 0 +} + +# Determine which afsd options to use. /etc/openafs/afs.conf contains the +# settings that are checked here. +choose_afsd_options() { + if [ -z "$OPTIONS" ] || [ "$OPTIONS" = "AUTOMATIC" ] ; then + CACHESIZE=`awk -F: '{print $3}' < /etc/openafs/cacheinfo` + if [ $CACHESIZE -lt 131072 ] ; then + OPTIONS=$SMALL + elif [ $CACHESIZE -lt 524288 ] ; then + OPTIONS=$MEDIUM + elif [ $CACHESIZE -lt 1048576 ] ; then + OPTIONS=$LARGE + elif [ $CACHESIZE -lt 2097152 ] ; then + OPTIONS=$XLARGE + else + OPTIONS=$XXLARGE + fi + fi + AFSD_OPTIONS="$OPTIONS $VERBOSE" + + # These variables are from /etc/openafs/afs.conf.client and are managed + # automatically by debconf. + if is_on $AFS_AFSDB ; then + AFSD_OPTIONS="$AFSD_OPTIONS -afsdb" + fi + if is_on $AFS_DYNROOT ; then + AFSD_OPTIONS="$AFSD_OPTIONS -dynroot" + fi + if is_on $AFS_FAKESTAT ; then + AFSD_OPTIONS="$AFSD_OPTIONS -fakestat" + fi +} + +# Start afsd. Be careful not to start it if another one is already running, +# as that has a bad tendency to hang the system. +start_client() { + if pidof /usr/sbin/afsd >/dev/null ; then + echo "." + else + choose_afsd_options + echo " afsd." + start-stop-daemon --start --quiet --exec /usr/sbin/afsd \ + -- $AFSD_OPTIONS + fi + + # From /etc/openafs/afs.conf.client, whether to enable fcrypt encryption. + if is_on $AFS_CRYPT ; then + fs setcrypt on + fi +} + + +case "$1" in +start) + if is_on $AFS_CLIENT && test -x /usr/sbin/afsd ; then + echo -n "Starting AFS services:" + if load_client ; then + start_client + $AFS_POST_INIT + else + echo "" + echo "Failed to load AFS kernel module, not starting AFS" >&2 + exit 1 + fi + fi + ;; + +force-start) + if test -x /usr/sbin/afsd ; then + echo -n "Starting AFS services:" + if load_client ; then + start_client + $AFS_POST_INIT + else + echo "" + echo "Failed to load AFS kernel module, not starting AFS" >&2 + exit 1 + fi + fi + ;; + +stop|force-stop) + echo -n "Stopping AFS services:" + if mount | grep -q '^AFS' ; then + umount /afs + echo -n " afsd" + fi + pidof /usr/sbin/afsd >/dev/null && afsd -shutdown + + LIBAFS=`/sbin/lsmod | awk 'BEGIN { FS = " " } /openafs/ { print $1 }'` + if [ -n "$LIBAFS" ] ; then + /sbin/rmmod $LIBAFS + echo -n " openafs" + fi + echo "." + ;; + +restart|force-reload) + "$0" stop + "$0" start + ;; + +*) + echo Usage: \ + 'openafs-client {start|force-start|stop|restart|force-reload}' >&2 + exit 1 + +esac diff --git a/debian/rules b/debian/rules index 2875a06ea..cffb2665b 100755 --- a/debian/rules +++ b/debian/rules @@ -89,7 +89,7 @@ clean: rm -f build-stamp configure-stamp configure-modules-stamp rm -f build-modules-stamp -$(MAKE) -ki distclean - -rm -rf dest $(SYS_NAME) @sys debian/openafs-client.init src/pic + -rm -rf dest $(SYS_NAME) @sys src/pic dh_clean install: DH_OPTIONS= @@ -114,9 +114,7 @@ install: build debian/libpam-openafs-kaserver/lib/security/pam_afs.so install -m 644 -c debian/CellServDB \ debian/openafs-client/usr/share/openafs - install -m 755 -c dest/root.client/usr/vice/etc/afs.rc \ - debian/openafs-client.init - install -m 644 -c dest/root.client/usr/vice/etc/afs.conf \ + install -m 644 -c debian/afs.conf \ debian/openafs-client/etc/openafs/afs.conf install -d debian/openafs-dbserver/usr/share/man/man8 diff --git a/src/afsd/afs.conf.linux b/src/afsd/afs.conf.linux index 413985fb0..4494024d2 100644 --- a/src/afsd/afs.conf.linux +++ b/src/afsd/afs.conf.linux @@ -1,4 +1,4 @@ - +#! /bin/sh # Copyright 2000, International Business Machines Corporation and others. # All Rights Reserved. # @@ -6,29 +6,66 @@ # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +############################################################################ +# On most linuces copy this file to +# /etc/sysconfig/afs +# so afs.rc can use it as config file. +############################################################################ + # Configuration information for AFS client # AFS_CLIENT and AFS_SERVER determine if we should start the client and or -# the bosserver. Possible values are true and false. -# These are loaded from files written by debconf -# AFS_NOSETTIME is currently defaulted to auto because we believe this is a reasonable default -AFS_NOSETTIME=auto -test -f /etc/openafs/afs.conf.client && . /etc/openafs/afs.conf.client - +# the bosserver. Possible values are on and off. +AFS_CLIENT=on AFS_SERVER=off # ENABLE_AFSDB and ENABLE_DYNROOT determine whether AFSDB support and # Dynroot support (dynamically generated /afs), respectively, should be # enabled in the AFS client. ENABLE_AFSDB=on -ENABLE_DYNROOT=off +ENABLE_DYNROOT=on # AFS client configuration options: -XXLARGE="-stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000" -XLARGE="-stat 3600 -dcache 3600 -daemons 5 -volumes 196 -files 50000" -LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128" -MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70" -SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50" +# --------------------------------------------------------------------------- +# possible AFS client afsd configuration options (from 1.3.74) are +# -blocks The number of blocks available in the workstation cache. +# -files The target number of files in the workstation cache (Default: +# 1000). +# -rootvol The name of the root volume to use. +# -stat The number of stat cache entries. +# -hosts List of servers to check for volume location info FOR THE +# HOME CELL. +# -memcache Use an in-memory cache rather than disk. +# -cachedir The base directory for the workstation cache. +# -mountdir The directory on which the AFS is to be mounted. +# -confdir The configuration directory . +# -nosettime Don't keep checking the time to avoid drift. +# -verbose Be chatty. +# -debug Print out additional debugging info. +# -kerndev [OBSOLETE] The kernel device for AFS. +# -dontfork [OBSOLETE] Don't fork off as a new process. +# -daemons The number of background daemons to start (Default: 2). +# -rmtsys Also fires up an afs remote sys call (e.g. pioctl, setpag) +# support daemon +# -chunksize [n] 2^n is the chunksize to be used. 0 is default. +# -dcache The number of data cache entries. +# -biods Number of bkg I/O daemons (AIX3.1 only) +# -prealloc Number of preallocated "small" memory blocks +# -pininodes Number of inodes which can be spared from inode[] for +# pointing at Vfiles. If this is set too high, you may have +# system problems, which can only be ameliorated by changing +# NINODE (or equivalent) and rebuilding the kernel. +# This option is now disabled. +# -logfile Place where to put the logfile (default in /etc/AFSLog. +# -waitclose make close calls always synchronous (slows em down, tho) +# -files_per_subdir [n] number of files per cache subdir. (def=2048) +# -shutdown Shutdown afs daemons +# --------------------------------------------------------------------------- +XXLARGE="-fakestat -stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000" +XLARGE="-fakestat -stat 3600 -dcache 3600 -daemons 5 -volumes 196 -files 50000" +LARGE="-fakestat -stat 2800 -dcache 2400 -daemons 5 -volumes 128" +MEDIUM="-fakestat -stat 2000 -dcache 800 -daemons 3 -volumes 70" +SMALL="-fakestat -stat 300 -dcache 100 -daemons 2 -volumes 50" # cachesize and according options are set by /afs/rc.d/init.d/afs # * if you set CACHESIZE to "AUTOMATIC", it will automatically be chosen @@ -37,46 +74,20 @@ SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50" # of options based on the cache size # otherwise the values specified here will be used. So be careful! # Note: if you leave these as-is, no changes are made. -CACHESIZE= -OPTIONS=$MEDIUM +CACHESIZE=AUTOMATIC +#CACHESIZE=50000 +OPTIONS=AUTOMATIC +#OPTIONS=$SMALL -# if we're looking for ntp, what files do we look for? -TIME_SBIN_PROGS="ntptime ntpd chronyd" - -# Should we support afsdb? -if [ "x$AFS_AFSDB" = "xtrue" ] ; then - AFSDB="-afsdb" - else AFSDB="" - fi -if [ "x$AFS_DYNROOT" = "xtrue" ] ; then - DYNROOT="-dynroot" - else DYNROOT="" - fi -if [ "x$AFS_FAKESTAT" = "xtrue" ] ; then - FAKESTAT="-fakestat" - else FAKESTAT="" - fi -if [ "x$AFS_NOSETTIME" = "xtrue" ] ; then - NOSETTIME="-nosettime" - elif [ "x$AFS_NOSETTIME" = "xauto" ] ; then - for f in $TIME_SBIN_PROGS; do - test -e "/usr/sbin/$f" && { - NOSETTIME="-nosettime" - break - } - done - else - NOSETTIME="" - fi +# you should never need to change these settings +AFSDIR=/afs +CACHEDIR=/usr/vice/cache +CACHEINFO=/usr/vice/etc/cacheinfo # Set to "-verbose" for a lot of debugging information from afsd. Only # useful for debugging as it prints _a lot_ of information. VERBOSE= -# OPTIONS are the options passed to afsd. -OPTIONS="$OPTIONS $VERBOSE $DYNROOT $FAKESTAT $AFSDB $NOSETTIME" - - # Sample server preferences function. Set server preferences using this. # afs_serverprefs() { # /usr/afsws/etc/fs setserverprefs diff --git a/src/afsd/afs.rc.linux b/src/afsd/afs.rc.linux index 8f8f7759c..5b2405df8 100644 --- a/src/afsd/afs.rc.linux +++ b/src/afsd/afs.rc.linux @@ -1,5 +1,4 @@ #! /bin/sh -# Modified by Sam Hartman for Debian # Copyright 2000, International Business Machines Corporation and others. # All Rights Reserved. # @@ -10,29 +9,84 @@ # AFS Start and stop AFS components # # -# chkconfig: 345 60 20 +# chkconfig: 35 60 20 # description: AFS is a distributed file system which provides location # transparency, caching and secure authentication. # Additional configuration can be done in the /etc/sysconfig/afs # file. Read the documentation in that file for more information. # +# The following section is used at least by SuSE insserv(8) +### BEGIN INIT INFO +# Provides: afs +# Required-Start: $network +# Required-Stop: $network +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: AFS is a distributed file system which provides location +# transparency, caching and secure authentication. +# Additional configuration can be done in the /etc/sysconfig/afs +# file. Read the documentation in that file for more information. +### END INIT INFO +# # Note that AFS does not use a pid file in /var/run. It is turned off by # unmounting /afs. -exec 3>/dev/null -exec &2 + return 1 + elif [ $ADDRS = 0 ]; then + echo afs: No interfaces with IP address 1>&2 + return 1 + fi + return 0 } # If choose_client can't correctly determine which client to use, set @@ -51,24 +105,14 @@ choose_client() { esac # For now, just use uname -r to get the module version. - VERSION=`uname -r` - - # The Debian OpenAFS packages do not add the .mp by default as of 1.3, - # but modules obtained from other sources may. If a module with the - # .mp exists and this is an SMP system, use it; otherwise, use the - # default value. Unset $MP if not using it so that we can use it - # later in the call to modprobe. - if [ -n "$MP" -a -f "$MODLOADDIR/openafs${MP}.o" ] ; then - LIBAFS=openafs${MP}.o - elif [ -n "$MP" -a -f "$MODLOADDIR/openafs${MP}.ko" ] ; then - LIBAFS=openafs${MP}.ko - elif [ -f "$MODLOADDIR/openafs.ko" ] ; then - MP= - LIBAFS=openafs.ko - else - MP= - LIBAFS=openafs.o - fi + case $KERNEL_VERSION in + [1-2].[0-5].*) + LIBAFS=libafs-$KERNEL_VERSION$MP.o + ;; + *) + LIBAFS=libafs-$KERNEL_VERSION$MP.ko + ;; + esac } # @@ -79,8 +123,14 @@ choose_client() { # unregister_filesystem_Rsmp_b240cad8 is a typcial SMP version string from # a kernel built from ftp.kernel.org # - -KSYMS_FILE=/proc/ksyms +case $KERNEL_VERSION in + [1-2].[0-5].*) + KSYMS_FILE=/proc/ksyms + ;; + *) + KSYMS_FILE=/proc/kallsyms + ;; +esac SEARCH_STR="unregister_filesystem" DEFAULT_SMP_PREFIX="smp_" # Redhat kernels need "smp" instead PREFIX="" # none needed for UP with <= 1Gig memory @@ -91,8 +141,16 @@ set_prefix() h8="$h$h$h$h$h$h$h$h" prefix_set=0 - set X `fgrep $SEARCH_STR $KSYMS_FILE 2> /dev/null`; shift - str=$2 + set X `egrep "\<$SEARCH_STR" $KSYMS_FILE 2> /dev/null`; shift + + case $KERNEL_VERSION in + [1-2].[0-5].*) + str=$2 + ;; + *) + str=$3 + ;; + esac case $str in ${SEARCH_STR}_R$h8) # No prefix required @@ -125,8 +183,7 @@ set_prefix() esac } - -MODLOADDIR=/lib/modules/`uname -r`/fs +MODLOADDIR=/usr/vice/etc/modload # load_client loads the AFS client module if it's not already loaded. load_client() { # If LIBAFS is set, use it. @@ -136,38 +193,83 @@ load_client() { fi if [ ! -f "$MODLOADDIR/$LIBAFS" ] ; then - cat < $MODLOADDIR/libafs.map 2>&1 + ;; + *) + /sbin/insmod $MODLOADDIR/$LIBAFS > $MODLOADDIR/libafs.map 2>&1 + ;; + esac + else + /sbin/insmod $MODLOADDIR/$LIBAFS > $MODLOADDIR/libafs.map 2>&1 fi } -# start_client() -- run afsd -start_client() { - if pidof /usr/sbin/afsd >/dev/null ; then : - else - start-stop-daemon --start --quiet --exec /usr/sbin/afsd \ - -- ${OPTIONS} - echo -n " afsd" - fi - if [ x$AFS_CRYPT = xtrue ] ; then - fs setcrypt on - fi +generate_cacheinfo() { + if [ "$CACHESIZE" = "AUTOMATIC" ]; then + LINE=`df -k $CACHE | tail -1` + PART=`echo $LINE | awk '{ if ( ($NF != "/usr") && ($NF != "/") ) print $NF; else print "NONE";}'` + if [ "$PART" = "NONE" ]; then + echo "$CACHE or /usr/vice is not a separate partition" + echo "you have to change the cachesize in $SYSCNF by hand" + echo "AFS will be started with a VERY small cache of 8Mb." + CACHESIZE=8000 + else + # Check to see if df has pretty-printed for long dev (i.e. LVM) + FCHAR=`echo $LINE | cut -c 1` + if [ "$FCHAR" = "/" ]; then + PARTSIZE=`echo $LINE | awk '{print $2}'` + else + PARTSIZE=`echo $LINE | awk '{print $1}'` + fi + CACHESIZE=`echo $PARTSIZE | awk '{printf "%d",int(($1*.8)/1000)*1000}'` + fi + fi + if [ "x$CACHESIZE" != "x" ]; then + echo $AFS:$CACHE:$CACHESIZE >$CACHEINFO + chmod 0644 $CACHEINFO + else + CACHESIZE=`awk -F: '{print $3}' < $CACHEINFO` + fi } +choose_afsdoptions() { + if [ -z "$OPTIONS" -o "$OPTIONS" = "AUTOMATIC" ]; then + if [ $CACHESIZE -lt 131072 ]; then + OPTIONS=$SMALL + elif [ $CACHESIZE -lt 524288 ]; then + OPTIONS=$MEDIUM + elif [ $CACHESIZE -lt 1048576 ]; then + OPTIONS=$LARGE + elif [ $CACHESIZE -lt 2097152 ]; then + OPTIONS=$XLARGE + else + OPTIONS=$XXLARGE + fi + fi + AFSD_OPTIONS="$OPTIONS $VERBOSE" + if is_on $ENABLE_AFSDB; then + AFSD_OPTIONS="$AFSD_OPTIONS -afsdb" + fi + if is_on $ENABLE_DYNROOT; then + AFSD_OPTIONS="$AFSD_OPTIONS -dynroot" + fi +} case "$1" in start) + if [ ! "$afs_rh" -o ! -f /var/lock/subsys/afs ]; then + if [ `echo "$OPTIONS" | grep -c dynroot` = 0 ]; then + on_network || exit 1 + fi # Load kernel extensions if load_client ; then : else @@ -175,59 +277,64 @@ case "$1" in exit 1 fi - # Start AFS client - if is_on $AFS_CLIENT && test -x /usr/sbin/afsd ; then - echo -n "Starting AFS services: " - start_client - echo "." - $AFS_POST_INIT - fi - - ;; - -force-start) - # Load kernel extensions - if load_client ; then : - else - echo Failed to load AFS client, not starting AFS services. - exit 1 + echo "Starting AFS services..... " + # Start bosserver, it if exists + if is_on $AFS_SERVER && test -x /usr/afs/bin/bosserver ; then + /usr/afs/bin/bosserver + test "$afs_rh" && touch /var/lock/subsys/afs fi # Start AFS client - if test -x /usr/sbin/afsd ; then - echo -n "Starting AFS services: " - start_client - echo "." + if is_on $AFS_CLIENT && test -x /usr/vice/etc/afsd ; then + generate_cacheinfo + choose_afsdoptions + /usr/vice/etc/afsd ${AFSD_OPTIONS} + test "$afs_rh" && touch /var/lock/subsys/afs $AFS_POST_INIT fi - ;; - stop|force-stop) + fi + ;; + + stop) + if [ ! "$afs_rh" -o -f /var/lock/subsys/afs ]; then # Stop AFS - echo -n "Stopping AFS services: " + echo "Stopping AFS services..... " - if mount |grep -q \^AFS ; then + if is_on $AFS_CLIENT ; then + if [ -x /usr/vice/etc/killafs ] ; then + runcmd "Sending all processes using /afs the TERM signal ..." /usr/vice/etc/killafs TERM + runcmd "Sending all processes using /afs the KILL signal ..." /usr/vice/etc/killafs KILL + fi umount /afs - echo -n " afsd" fi - pidof /usr/sbin/afsd >/dev/null &&afsd -shutdown - LIBAFS=`/sbin/lsmod | fgrep openafs` + if is_on $AFS_SERVER && test -x /usr/bin/bos ; then + echo "Stopping AFS bosserver" + /usr/bin/bos shutdown localhost -localauth -wait + killall -HUP bosserver + fi + + LIBAFS=`/sbin/lsmod | fgrep libafs` if [ -n "$LIBAFS" ] ; then LIBAFS=`echo $LIBAFS | awk 'BEGIN { FS = " " } { print $1 }'` /sbin/rmmod $LIBAFS - echo -n " libafs" fi - echo "." + rm -f /var/lock/subsys/afs + fi ;; - restart|force-reload) - "$0" stop - "$0" start + restart) + # Restart AFS + $0 stop + $0 start ;; *) - echo Usage: 'openafs-client ' + echo Usage: 'afs ' esac +exit 0 + +action fool the Red Hat initscripts