diff --git a/conf.d/bootmisc b/conf.d/bootmisc index dd5b08e01..a7d58e258 100644 --- a/conf.d/bootmisc +++ b/conf.d/bootmisc @@ -1,4 +1,6 @@ -# List of /tmp directories we should clean up +# List of /tmp-like directories we should clean up. tmpfs mounts are ignored +# since they will be empty at boot. +# Use of tmpfs for /tmp itself is strongly recommended if possible. clean_tmp_dirs="/tmp" # Should we wipe the tmp paths completely or just selectively remove known diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index b1a849a37..7531befa1 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -33,11 +33,10 @@ cleanup_tmp_dir() if yesno $wipe_tmp; then ebegin "Wiping $dir directory" - # Faster than raw find - if ! rm -rf -- [!ajlq\.]* 2>/dev/null ; then - # Blah, too many files - find . -maxdepth 1 -name '[!ajlq\.]*' -exec rm -rf -- {} + - fi + # The find commands below are taken from Debian and modified to + # use posix syntax + find "${dir}" -xdev ! -type d -exec rm -- {} + + find "${dir}" -xdev -type d -empty -exec rmdir -- {} + # pam_mktemp creates a .private directory within which # each user gets a private directory with immutable