Skip to content

Commit

Permalink
bootmisc: use find for all cleanup in tmp directories
Browse files Browse the repository at this point in the history
This is for #458
  • Loading branch information
williamh committed Oct 11, 2021
1 parent 2b55ac7 commit f4e8b69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion conf.d/bootmisc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions init.d/bootmisc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f4e8b69

Please sign in to comment.