summaryrefslogtreecommitdiff
path: root/mk/check/check-fakehome.mk
blob: f795d1b14035bec1ff5a7a84b994a15930acae04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# $NetBSD: check-fakehome.mk,v 1.4 2014/10/12 23:39:17 joerg Exp $
#
# This file checks that the package does not install files to $HOME.
#
# User-settable variables:
#
# CHECK_FAKEHOME
#	Specifies whether the check should be run at all.
#
#	Possible values: yes, no.
#
#	Default value: yes for PKG_DEVELOPER, no otherwise.
#
# Package-settable variables:
#

_VARGROUPS+=			check-fakehome
_USER_VARS.check-fakehome=	CHECK_FAKEHOME
_PKG_VARS.check-fakehome=	# None for now. One might be added to override
#				  the test if the fakehome test is made fatal.

.if ${PKG_DEVELOPER:Uno} != "no"
CHECK_FAKEHOME?=		yes
.else
CHECK_FAKEHOME?=		no
.endif

.if ${CHECK_FAKEHOME:M[Yy][Ee][Ss]}
privileged-install-hook: _check-fakehome
.endif

_check-fakehome: .PHONY
	${RUN} if [ `ls -a ${FAKEHOMEDIR:Q} | ${AWK} 			\
		'{if ($$0 != "." && $$0 != "..") {x=1; exit}}		\
		END {print x + 0}'					\
	` = 1 ]; then							\
		${WARNING_MSG} "[check-fakehome.mk] fake home directory not empty:"; \
		find ${FAKEHOMEDIR} -print | ${SED} 's/^/	/';	\
		exit 0;							\
	fi