4 ##################################################################
7 # bcheckrc (afs) - /sbin/fs/afs/bcheckrc
10 # This file contains scripts/commands necessary to checks
11 # the afs file systems before mounting.
13 # It should be invoked by the generic bcheckrc script only.
21 # Side effects of this test:
24 # Supporting files and Relationship:
25 # i) various "/sbin/fs/afs" commands are used by this script.
26 # ii) generic bcheckrc scrtipt located in the /sbin
27 # directory invokes this script.
30 ##################################################################
33 # Description - This function will check (fsck) all the afs file systems
34 # in the static file system table, /etc/fstab.
36 # Result values - status = 0 for success
37 # status = non-0 for failure
39 # Used (exclusively) by - /sbin/bcheckrc's fsck_afs portion
44 # ROOTSHELL - is the command that gives the user a shell in which
45 # to run fsck interactively. Someday fsck -y should
46 # be fixed to give the right answers to the questions,
47 # rather than always "yes", so this error-prone
48 # interactive fixing business can go away entirely.
53 # set stty (for manual mode)
55 /sbin/stty clocal icanon echo opost onlcr ixon icrnl ignpar erase "^h"
58 # In the remaining part of the function is devoted to the actual
59 # cleaning of the afs file systems.
61 # 1) run fsck -m and determine if any afs file systems
64 # 2) check exit status of fsck -m -
66 # 0 - indicates (and lists) that this afs file
67 # system was verified clean. Continues to
70 # * - indicates and lists the file systems that
71 # were not properly shutdown. File systems
72 # that are corrupt should be fixed before
73 # continuing with the boot.
76 # 3) exit the function with the appropriate return status.
79 # When the file systems are corrupt the following steps are
82 # 1) fsck_afs(1M) command is invoked using the
83 # following command line - "/sbin/fsck -F afs -P -f"
84 # (refer to the fsck_afs(1M) man page)
86 # 2) The following actions are taken according to
87 # the appropriate return values ...
88 # 0 - the corrupt file system was fixed.
89 # Continue with boot'ing.
90 # * - could not automatically fix the
91 # corrupt file system, going into
92 # manual mode (shell).
96 afs_partitions_clean()
98 serverPartition=0 # number of AFS server partitions
100 for name in `/sbin/awk ' $0 ~ /^[ \t]*#/ { next }
101 $3 == "afs" { print $1 }' /etc/fstab`
103 /sbin/fs/hfs/fsck -m $name # check sanity
106 echo Cleaning AFS server partition $name
107 /sbin/fs/afs/fsck -P -f $name
111 echo AFS server partition $name is fixed
115 echo "UNEXPECTED ERROR DURING fsck -P, RUN fsck INTERACT
117 echo "LOGGING IN AS root FOR MANUAL fsck, ENTER ^D WHEN
119 PS1="(in bcheckrc)# "
122 echo "CONTINUING bcheckrc"
131 if [ serverPartition -ne 1 ]
133 echo "NO AFS server partitions found"
141 #*********************************************************************
142 # End of bcheckrc (afs)
143 #*********************************************************************