summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2008-02-05 09:45:00 +0000
committertnn <tnn@pkgsrc.org>2008-02-05 09:45:00 +0000
commit3b84dc1b5a56ce3fa655450cfd66cdc1a6cc1922 (patch)
tree6991861e83c0770bd80dca5ec6e4cba40310efd1 /mk
parentc4a4d2f7db0832d27e7c71335660a81586bf54ab (diff)
downloadpkgsrc-3b84dc1b5a56ce3fa655450cfd66cdc1a6cc1922.tar.gz
This is the check part of the fake $HOME code. Not enabled yet.
Diffstat (limited to 'mk')
-rw-r--r--mk/check/check-fakehome.mk40
1 files changed, 40 insertions, 0 deletions
diff --git a/mk/check/check-fakehome.mk b/mk/check/check-fakehome.mk
new file mode 100644
index 00000000000..c7743cf7cd8
--- /dev/null
+++ b/mk/check/check-fakehome.mk
@@ -0,0 +1,40 @@
+# $NetBSD: check-fakehome.mk,v 1.1 2008/02/05 09:45:00 tnn 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 defined(PKG_DEVELOPER)
+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 != "..") cnt++} \
+ END {print cnt?1:0}' \
+ ` = 1 ]; then \
+ ${WARNING_MSG} "[check-fakehome.mk] fake home directory not empty:"; \
+ find ${FAKEHOMEDIR} -print | ${SED} 's/^/ /'; \
+ exit 0; \
+ fi