2 # This script installs new directories on NFS servers.
4 # The following exit codes are defined and MUST BE CONSISTENT with the
5 # SMS error codes the library uses:
6 set SMS_PROTO = 47836477
8 set path=(/etc /bin /usr/bin /usr/etc)
10 # Find out what device we're working on
13 set TMPSTOR = /tmp/tmpstor # Temporary area for user . files
14 set USERTAR = /tmp/proto.tar # Tarfile for user . files
16 # Give ourselves a fresh work area
20 if ($status) exit $SMS_PROTO
22 # Make a tarfile containing the user prototype files for future use.
23 (cd /usr/prototype_user;tar cf - .) | (cd $TMPSTOR; tar xpf -)
24 # Remove the welcome file. This may change.
25 rm -f $TMPSTOR/welcome
27 chmod 700 $TMPSTOR/Mail
28 (cd $TMPSTOR; tar cf $USERTAR .)
29 if ($status) exit $SMS_PROTO
32 # So that the new directories get the right protections.
36 # Do this until there are no more lines of input
38 if ($#input != 4) break
45 # Don't do anything if the directory already exists
49 set tmpdir = $dir:h/_$dir:t
50 # Don't clobber this directory if it exists.
55 # At some point it may be wise to check the status here and
56 # return a soft failure, but the current protocol doesn't
61 if (! -d $tmpdir) continue
62 chown $uid.$gid $tmpdir
64 # At some point, we may wish to add a more elegant way of handling
65 # locker types. The current arrangement allows for easy adding of
66 # default actions here.
70 # ***** Remove this when /etc/encorce_quota becomes obsolete!
71 # Give this filesystem a 600K quota
72 setquota -u $dev $uid 600
75 # Give user prototype files
76 # sms_untar is a setuid argv[1] tar xfp -
77 (cd $tmpdir; sms_untar $uid < $USERTAR)
85 ### Soft failure when ready