# QA checks for systemd units.

systemd_check() {
	local systemddir f

	# Common mistakes in systemd service files.
	if type -P pkg-config >/dev/null && pkg-config --exists systemd; then
		systemddir=$(pkg-config --variable=systemdsystemunitdir systemd)
	else
		systemddir=/usr/lib/systemd/system
	fi
	if [[ -d ${ED%/}${systemddir} ]]; then
		f=$(grep -sH '^EnvironmentFile.*=.*/etc/conf\.d' "${ED%/}${systemddir}"/*.service)
		if [[ -n ${f} ]] ; then
			eqawarn "QA Notice: systemd units using /etc/conf.d detected:"
			eqawarn "${f//${D}}"
			eqawarn "See: https://wiki.gentoo.org/wiki/Project:Systemd/conf.d_files"
		fi
	fi
}

systemd_check
: # guarantee successful exit

# vim:ft=sh
