# Check for directories that need to be created at runtime

runtime_dir_check() {
	# It's ok to create these directories, but not to install into them. #493154
	# TODO: We should add var/lib to this list.
	local x f=
	for x in var/cache var/lock var/run var/tmp run ; do
		if [[ ! -L ${ED}/${x} && -d ${ED}/${x} ]] ; then
			if [[ -z $(find "${ED}/${x}" -prune -empty) ]] ; then
				f+=$(cd "${ED}"; find "${x}" -printf '  %p\n')
			fi
		fi
	done
	if [[ -n ${f} ]] ; then
		eqawarn "QA Notice: This ebuild installs into paths that should be created at runtime."
		eqawarn " To fix, simply do not install into these directories.  Instead, your package"
		eqawarn " should create dirs on the fly at runtime as needed via init scripts/etc..."
		eqawarn
		eqawarn "${f}"
	fi
}

runtime_dir_check
: # guarantee successful exit

# vim:ft=sh
