2 # This script performs nfs updates on servers.
6 # The following exit codes are defined and MUST BE CONSISTENT with the
7 # error codes the library uses:
8 set MR_NOCRED = 47836470
9 set MR_MKCRED = 47836474
10 set MR_TARERR = 47836476
12 set path=(/etc /bin /usr/bin /usr/etc /usr/athena/etc)
15 # The file containg the information for the update
16 set TARFILE=/var/tmp/nfs.out
17 # The directory into which we will empty the tarfile
18 set SRC_DIR=/var/tmp/nfs.dir
20 # Alert if the tarfile does not exist
21 if (! -r $TARFILE) then
25 # Create a fresh source directory
30 set uchost=`hostname | tr '[a-z]' '[A-Z]'`
31 if ($uchost !~ *.*) then
32 set uchost=$uchost.MIT.EDU
37 # Just extract everything since some of what we need exists as
38 # hardlinks and tar doesn't deal well with extracting them in isolation.
40 if ($status) exit $MR_TARERR
42 foreach type (dirs quotas)
43 echo "Installing ${type}:"
44 foreach i ( ${uchost}*.${type} )
46 # Convert the from the filename HOST.@dev@device.type to /dev/device
47 set dev=`echo $i | sed "s,.${type},," | sed "s,${uchost}.,," | sed "s,@,/,g"`
49 ./install_${type} $dev < $i
50 if ($status) exit $status
51 if ($type == quotas) ./zero_quotas $dev < $i
52 if ($status) exit $status
53 # save the files used here for later debugging
59 # build new credentials files.
60 rm -f /usr/etc/credentials.new
61 cp ${uchost}.cred /usr/etc/credentials.new
62 if ($status) exit $MR_NOCRED
63 if (-e /usr/etc/credentials.local) then
64 cat /usr/etc/credentials.local >> /usr/etc/credentials.new
67 # After this point, if /tmp gets cleared out by reactivate (which
68 # happens on a combined server/workstation) we don't care.
69 mkcred /usr/etc/credentials.new
70 if ($status) exit $MR_MKCRED
72 # Try to install the files
73 foreach e ( "" .dir .pag)
74 mv -f /usr/etc/credentials.new$e /usr/etc/credentials$e
77 # If any of them didn't get installed, fail
78 foreach e ( "" .dir .pag)
79 if (! -e /usr/etc/credentials$e) exit $MR_NOCRED
85 if ( -f $TARFILE ) rm -f $TARFILE
86 if ( -d $SRC_DIR ) then