remove cruft from /run directory

The /run directory is a mount point for a tmpfs and should not contain
any files or directories.  This cleans out the /run/openrc
symlink and any other files which were incorrectly placed in /run.
Thanks to Ian Stakenvicius for pointing out this solution.
This commit is contained in:
William Hubbs 2013-01-31 12:05:37 -06:00
parent 8328b88360
commit 8be072628c

View File

@ -87,6 +87,16 @@ migrate_to_run()
fi fi
} }
clean_run()
{
local dir
dir=$(mktemp -d)
mount --bind / $dir
rm -rf $dir/run/*
umount $dir
rm -rf $dir
}
start() start()
{ {
# Remove any added console dirs # Remove any added console dirs
@ -115,6 +125,7 @@ start()
if [ "$RC_UNAME" = Linux -a -d /run ]; then if [ "$RC_UNAME" = Linux -a -d /run ]; then
migrate_to_run /var/lock /run/lock migrate_to_run /var/lock /run/lock
migrate_to_run /var/run /run migrate_to_run /var/run /run
clean_run
fi fi
if checkpath -W /var/run; then if checkpath -W /var/run; then