3 # $NetBSD: perusertmp,v 1.6 2007/02/15 13:27:35 tron Exp $
10 $_rc_subr_loaded .
/etc
/rc.subr
14 start_cmd
="perusertmp_start"
19 echo "Preparing per-user /tmp."
21 # If /tmp is a mount point, we can't do anything.
22 if [ -d "/tmp" ]; then
25 mount_point
=$
(cd /tmp
&& /bin
/df . |
/usr
/bin
/tail -1 |
/usr
/bin
/awk '{print $6}')
26 if [ "${mount_point}" = "/tmp" ]; then
27 echo "WARNING: /tmp is mounted."
32 # Enable magic symlinks.
33 /sbin
/sysctl
-qw vfs.generic.magiclinks
=1
35 # Fixup real temporary directory.
36 if [ ! -d ${per_user_tmp_dir} ]; then
37 /bin
/mkdir
-p ${per_user_tmp_dir}
39 /usr
/sbin
/chown root
:wheel
${per_user_tmp_dir}
40 /bin
/chmod 0555 ${per_user_tmp_dir}
42 # Create magic link for /tmp.
43 if [ "$(/usr/bin/readlink /tmp)" != ${per_user_tmp_dir}/@ruid
]; then
45 /bin
/ln -s ${per_user_tmp_dir}/@ruid
/tmp