]> andersk Git - moira.git/blame - gen/nfs.sh
remove the Solaris tmpfs hack since everything should be running the
[moira.git] / gen / nfs.sh
CommitLineData
51bf07bb 1#!/bin/csh -f
39f6c9df 2# This script performs nfs updates on servers.
e46282d6 3#
568331c6 4# $Header$
39f6c9df 5
6# The following exit codes are defined and MUST BE CONSISTENT with the
59ec8dae 7# error codes the library uses:
2ce085d2 8set MR_NOCRED = 47836470
9set MR_MKCRED = 47836474
10set MR_TARERR = 47836476
39f6c9df 11
7460e259 12set path=(/etc /bin /usr/bin /usr/etc /usr/athena/etc)
b93a8e7c 13set nonomatch
51bf07bb 14
39f6c9df 15# The file containg the information for the update
be0d31bd 16set TARFILE=/var/tmp/nfs.out
39f6c9df 17# The directory into which we will empty the tarfile
be0d31bd 18set SRC_DIR=/var/tmp/nfs.dir
39f6c9df 19
39f6c9df 20# Alert if the tarfile does not exist
21if (! -r $TARFILE) then
2ce085d2 22 exit $MR_TARERR
39f6c9df 23endif
51bf07bb 24
e46282d6 25# Create a fresh source directory
26rm -rf $SRC_DIR
27mkdir $SRC_DIR
28chmod 755 $SRC_DIR
29
4d4f4286 30set uchost=`hostname | tr '[a-z]' '[A-Z]'`
31if ($uchost !~ *.*) then
32 set uchost=$uchost.MIT.EDU
33endif
51bf07bb 34
39f6c9df 35cd $SRC_DIR
51bf07bb 36
18eb262b 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.
39tar xf $TARFILE
2ce085d2 40if ($status) exit $MR_TARERR
51bf07bb 41
39f6c9df 42foreach type (dirs quotas)
43 echo "Installing ${type}:"
44 foreach i ( ${uchost}*.${type} )
b93a8e7c 45 if (-e $i) then
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"`
48 echo ${uchost}:$dev
49 ./install_${type} $dev < $i
50 if ($status) exit $status
51 if ($type == quotas) ./zero_quotas $dev < $i
52 if ($status) exit $status
71ec1a6c 53 # save the files used here for later debugging
be0d31bd 54 mv $i /var/tmp
b93a8e7c 55 endif
39f6c9df 56 end
51bf07bb 57end
58
39f6c9df 59# build new credentials files.
51bf07bb 60rm -f /usr/etc/credentials.new
39f6c9df 61cp ${uchost}.cred /usr/etc/credentials.new
2ce085d2 62if ($status) exit $MR_NOCRED
3016143e 63if (-e /usr/etc/credentials.local) then
64 cat /usr/etc/credentials.local >> /usr/etc/credentials.new
65endif
51bf07bb 66
1f2d6eca 67# After this point, if /tmp gets cleared out by reactivate (which
68# happens on a combined server/workstation) we don't care.
8903fb65 69mkcred /usr/etc/credentials.new
70if ($status) exit $MR_MKCRED
39f6c9df 71
72# Try to install the files
73foreach e ( "" .dir .pag)
74 mv -f /usr/etc/credentials.new$e /usr/etc/credentials$e
75end
51bf07bb 76
39f6c9df 77# If any of them didn't get installed, fail
51bf07bb 78foreach e ( "" .dir .pag)
2ce085d2 79 if (! -e /usr/etc/credentials$e) exit $MR_NOCRED
51bf07bb 80end
81
e46282d6 82
83
39f6c9df 84# cleanup
67805159 85if ( -f $TARFILE ) rm -f $TARFILE
86if ( -d $SRC_DIR ) then
87 cd $SRC_DIR/..
88 rm -rf $SRC_DIR
89endif
90if ( -f $0 ) rm -r $0
39f6c9df 91
92exit 0
This page took 0.0976 seconds and 5 git commands to generate.