7 # REQUIRE: mountcritremote tmp
13 # Disguise rcvar for the start method to run irrespective of its setting.
14 rcvar1=`set_rcvar clear_tmp`
15 start_cmd="${name}_start"
20 # Make /tmp location variable for easier debugging.
23 # X related directories to create in /tmp.
24 local x11_socket_dirs="${tmp}/.X11-unix ${tmp}/.XIM-unix \
25 ${tmp}/.ICE-unix ${tmp}/.font-unix"
27 if checkyesno ${rcvar1}; then
28 check_startmsgs && echo "Clearing ${tmp}."
30 # This is not needed for mfs, but doesn't hurt anything.
32 # + The dot in ${tmp}/. is important.
33 # + Put -prune before -exec so find never descends
34 # into a directory that was already passed to rm -rf.
35 # + "--" in rm arguments isn't strictly necessary, but
36 # it can prevent foot-shooting in future.
37 # + /tmp/lost+found is preserved, but its contents are removed.
38 # + lost+found and quota.* in subdirectories are removed.
39 find -x ${tmp}/. ! -name . \
40 ! \( -name lost+found -type d -user root \) \
41 ! \( \( -name quota.user -or -name quota.group \) \
42 -type f -user root \) \
43 -prune -exec rm -rf -- {} +
44 elif checkyesno clear_tmp_X; then
45 # Remove X lock files, since they will prevent you from
46 # restarting X. Remove other X related directories.
47 check_startmsgs && echo "Clearing ${tmp} (X related)."
48 rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs}
50 if checkyesno clear_tmp_X; then
51 # Create X related directories with proper permissions.
52 mkdir -m 1777 ${x11_socket_dirs}