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 (cd $TMPSTOR; tar cf $USERTAR .)
25 if ($status) exit $SMS_PROTO
28 # So that the new directories get the right protections.
32 # Do this until there are no more lines of input
34 if ($#input != 4) break
41 # Don't do anything if the directory already exists
45 set tmpdir = $dir:h/_$dir:t
46 # Don't clobber this directory if it exists.
51 # At some point it may be wise to check the status here and
52 # return a soft failure, but the current protocol doesn't
57 if (! -d $tmpdir) continue
58 chown $uid.$gid $tmpdir
60 # At some point, we may wish to add a more elegant way of handling
61 # locker types. The current arrangement allows for easy adding of
62 # default actions here.
66 # ***** Remove this when /etc/encorce_quota becomes obsolete!
67 # Give this filesystem a 600K quota
68 setquota $dev $uid 600
71 # Give user prototype files
72 # sms_untar is a setuid argv[1] tar xfp -
73 (cd $tmpdir; sms_untar $uid < $USERTAR)
81 ### Soft failure when ready