2 # This script performs nfs updates on servers.
7 # The following exit codes are defined and MUST BE CONSISTENT with the
8 # MR error codes the library uses:
9 set MR_NOCRED = 47836470
10 set MR_MKCRED = 47836474
11 set MR_TARERR = 47836476
13 set path=(/etc /bin /usr/bin /usr/etc)
16 # The file containg the information for the update
17 set TARFILE=/tmp/nfs.out
18 # The directory into which we will empty the tarfile
19 set SRC_DIR=/tmp/nfs.dir
21 # Alert if the tarfile does not exist
22 if (! -r $TARFILE) then
26 # Create a fresh source directory
31 # Note that since MR is going to be exported, assuming .MIT.EDU is
32 # incorrect. For now however, it is probably not worth the effort
33 # to canonicalize the hostname, especially with the upcoming update
35 set uchost=`/bin/hostname | tr a-z A-Z`.MIT.EDU
39 # Just extract everything since some of what we need exists as
40 # hardlinks and tar doesn't deal well with extracting them in isolation.
42 if ($status) exit $MR_TARERR
44 foreach type (dirs quotas)
45 echo "Installing ${type}:"
46 foreach i ( ${uchost}*.${type} )
48 # Convert the from the filename HOST.@dev@device.type to /dev/device
49 set dev=`echo $i | sed "s,.${type},," | sed "s,${uchost}.,," | sed "s,@,/,g"`
51 ./install_${type} $dev < $i
52 if ($status) exit $status
53 if ($type == quotas) ./zero_quotas $dev < $i
54 if ($status) exit $status
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
64 /usr/etc/mkcred /usr/etc/credentials.new
65 if ($status) exit $MR_MKCRED
67 # Try to install the files
68 foreach e ( "" .dir .pag)
69 mv -f /usr/etc/credentials.new$e /usr/etc/credentials$e
72 # If any of them didn't get installed, fail
73 foreach e ( "" .dir .pag)
74 if (! -e /usr/etc/credentials$e) exit $MR_NOCRED