3 # $Id: AFSConfig,v 1.2 99/05/09 14:49:54 abe Exp $
5 # AFSConfig: configure for AFS
7 AFSD=/usr/vice/etc/afsd
10 STD=/usr/afsws/include
12 # Establish trap and stty handling.
15 trap 'rm -f $AH $AV; $ISIG; exit 1' 1 2 3 15
16 stty -a 2>&1 | grep isig > /dev/null
19 stty -a 2>&1 | egrep -e -isig > /dev/null
27 # Decide how to use echo.
30 if test "X$ECHO" = "X-n "
39 # Decide (perhaps for a second time) that AFS is installed.
42 if test -r /usr/vice/etc/ThisCell
44 cell=`awk '{print $1}' /usr/vice/etc/ThisCell`
49 CELL=`echo $cell | sed 's/\([^.]*\)\..*/\1/'`
50 if test "X$CELL" != "X"
52 if test ! -d /afs/$CELL
59 if test "X$CELL" = "X"
62 echo "This system does not appear to have AFS installed."
66 # See if AFS configuration is wanted.
70 AFS appears to be installed on this system; cell name "$CELL".
72 Lsof needs to be configured for AFS by identifying: 1) the directory
73 that includes the AFS header files needed to compile AFS support into
74 lsof; and 2) the version of AFS that is installed.
81 echo $EO "Do you want to configure lsof for AFS (y|n) [y]? $EC"
83 if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
87 if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
92 echo "Please answer y or n."
96 # See if $AH exists and points to a likely place.
100 echo "====================================================================="
107 if test -r $AHP/afs/afs.h
110 The location of the AFS header files required by lsof has been
111 previously identified as "$AHP".
113 Since <afs/afs.h> can be found there, that's probably correct.
120 echo $EO "Do you want to use $AHP again (y|n) [y]? $EC"
122 if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
127 if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
134 echo "Please answer y or n."
139 echo "\"$AHP\" has been previously specified as the location of the"
140 echo "AFS header files, but it lacks an afs/afs.h header file."
145 echo "The file ./$AH exists, but has no AFS header file path in it."
150 echo "No previous header location has been specified."
155 # See if the header files are in the "standard" place.
157 if test "X$AHOK" != "Xok"
162 echo "====================================================================="
164 echo "The AFS header files appear to be in the \"standard\" location --"
165 echo "i.e.: \"$STD\"."
170 echo $EO "Do you want to let lsof use them (y|n) [y]? $EC"
172 if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
178 if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
183 echo "Please answer y or n."
190 # Ask for the AFS header file location.
192 if test "X$AHOK" != "Xok"
195 echo "====================================================================="
197 echo "Please specify the full path where lsof can find the AFS header"
198 echo "files. A possible location is: \"/afs/$CELL/<sysname>/include\"."
200 The <sysname> component of the path is the AFS system name that
201 was used to configure and build AFS on this system. It is usually
202 constructed from a manufacturer or Unix operating system designation,
203 followed by a version number -- e.g., hp800_ux90, sun4m_54, vax_ul43,
204 etc. You may have to consult your AFS documentation to determine
205 what <sysname> applies to your configuration.
212 echo $EO "Do you want to see the contents of /afs/$CELL (y|n) [y]? $EC"
214 if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
218 if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
225 echo "Please answer y or n."
233 echo $EO "AFS header file path: $EC"
235 fc=`expr "${ANS}X" : '\(.\).*'`
236 if test "X$fc" = "X/"
238 if test -r $ANS/afs/afs.h
245 echo "$ANS/afs/afs.h doesn't exist."
246 echo "Please enter a path whose afs subdirectory contains afs.h"
250 echo "Please enter an absolute path name."
254 if test "X$AHOK" != "Xok"
256 echo "AFSConfig: unknown error"
260 # Determine AFS version.
265 echo "====================================================================="
269 The AFS version was previously specified as: $AVN
276 echo $EO "Is this the correct version number (y|n) [y]? $EC"
278 if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
282 if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
287 echo "Please answer y or n."
292 # See if the version number can be determined.
296 ANS=`strings $AFSD | grep "Base configuration afs" | sed 's/^.*ion afs\([^ ]*\) .*/\1/'`
297 TV=`echo $ANS | sed 's/^\([0-9]*\)\.\([0-9]*\)\(.*\)/\1 \2 \3/' | awk '{printf "%d.%d%s\n",$1,$2,$3}'`
298 if test "X$ANS" = "X$TV"
301 echo "====================================================================="
304 Examining $AFSD the AFS version number appears to be: $TV
311 echo $EO "Do you want to use this version number (y/n) [y]? $EC"
313 if test "X$ANS" = "Xn" -o "X$ANS" = "XN"
317 if test "X$ANS" = "Xy" -o "X$ANS" = "XY" -o "X$ANS" = "X"
323 echo "Please answer y or n."
330 # Ask for the version number.
333 echo "====================================================================="
338 echo $EO "Please enter the AFS version number: $EC"
340 TV=`echo $ANS | sed 's/^\([0-9]*\)\.\([0-9]*\)\(.*\)/\1 \2 \3/' | awk '{printf "%d.%d%s\n",$1,$2,$3}'`
341 if test "X$ANS" = "X$TV"