#!/usr/sbin/sh # # Copyright (c) 1988, 2011, Oracle and/or its affiliates. All rights reserved. # # For modifying the behavior of rmtmpfiles, do not edit this script. # Instead use svccfg(1m) to modify the SMF repository. To achieve # traditional System V treatment of /var/tmp, invoke the following # commands.: # # # svccfg # svc:> select system/rmtmpfiles # svc:/system/rmtmpfiles> setprop options/clean_vartmp="true" # svc:/system/rmtmpfiles> select default # svc:/system/rmtmpfiles:default> refresh # svc:/system/rmtmpfiles:default> exit # # Traditional SunOS 4.x behavior has been to not remove directories in # the /tmp directory; only simple files were removed. This lead to an # inconsistency when the tmpfs file system was used (which isn't persistent # across boots. The following adopts the traditional System V behavior # of removing everything in /tmp, unless /tmp or any of its subdirectories # are mount points for another filesystem. /sbin/mount | /usr/bin/egrep '^/tmp(/| )' >/dev/null 2>&1 || { if [ -h /tmp ]; then # Just remove files under directory if symbolic link /usr/bin/rm -rf /tmp/* else /usr/bin/rm -rf /tmp /usr/bin/mkdir -m 1777 /tmp /usr/bin/chown root:sys /tmp fi } # Clean up /etc directory for file in /etc/rem_name_to_major /etc/nologin; do [ -f $file ] && /usr/bin/rm -f $file done # Traditional SunOS 4.x behavior has been to not alter the contents of # /var/tmp (/usr/tmp) at boot time. This behavior is maintained as the # current default behavior. If the traditional System V behavior of # removing everything in /var/tmp is desired then clean up /var/tmp, # unless /var/tmp or any of its subdirectories are mount points for # another filesystem. CLEAN_VARTMP=`svcprop -c -p options/clean_vartmp $SMF_FMRI` if [ "$CLEAN_VARTMP" = "true" ]; then /sbin/mount | /usr/bin/egrep '^/var/tmp(/| )' >/dev/null 2>&1 || { cd /var/tmp || exit 0 # We carefully remove all files except the Ex* files (editor # temporary files), which expreserve will process later (in # S89PRESERVE). Of course, it would be simpler to just run # expreserve before this script, but that doesn't work -- # expreserve requires the name service, which is not available # until much later. /usr/bin/ls -a | /usr/bin/egrep -v '^(Ex.*|\.|\.\.)$' | /usr/bin/xargs /usr/bin/rm -rf -- 2>/dev/null } fi exit 0