summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrillig <rillig>2007-12-06 22:03:22 +0000
committerrillig <rillig>2007-12-06 22:03:22 +0000
commit24dcae79d3db00ee5a01ac2e092817592d8fac89 (patch)
treefc67548964639f5289dad33d9afdc44c8bb25e01 /mk
parent95db5ba59f5c47edbee82c93e070b082f62d6e68 (diff)
downloadpkgsrc-24dcae79d3db00ee5a01ac2e092817592d8fac89.tar.gz
Print an understandable error message if the number of arguments for
CONF_FILES, CONF_FILES_PERMS, REQD_FILES, REQD_FILES_PERMS is wrong. NB: The code doesn't read like "shift 5 || error_out" since NetBSD's shell exits if a shift fails in this case, instead of just reporting an error. Fixes PR 37489. I didn't fix the code in pkglint (which was suggested in the PR) since it seems too complicated to me. There is no support for a "MultipleShellWords" data type by now, and pkglint would have to know that SETUID_ROOT_PERMS is of type "ThreeShellWords: Username, Groupname, Filemode". That's too much work and doesn't look nicely.
Diffstat (limited to 'mk')
-rw-r--r--mk/pkginstall/bsd.pkginstall.mk7
1 files changed, 6 insertions, 1 deletions
diff --git a/mk/pkginstall/bsd.pkginstall.mk b/mk/pkginstall/bsd.pkginstall.mk
index 3e511ef0d74..ef1bc3fc319 100644
--- a/mk/pkginstall/bsd.pkginstall.mk
+++ b/mk/pkginstall/bsd.pkginstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.36 2007/11/23 11:50:19 rillig Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.37 2007/12/06 22:03:22 rillig Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and implements the
# common INSTALL/DEINSTALL scripts framework. To use the pkginstall
@@ -418,6 +418,7 @@ _pkginstall-postinstall-check: .PHONY
${RUN} p="${DESTDIR}${PREFIX}"; \
${_FUNC_STRIP_PREFIX}; \
canon() { f=`strip_prefix "$$1"`; case $$f in [!/]*) f="$$p/$$f"; esac; echo "$$f"; }; \
+ needargs() { [ $$3 -ge $$2 ] || ${FAIL_MSG} "[bsd.pkginstall.mk] $$1 must have a multiple of $$2 words. Rest: $$4"; }; \
set args ${RCD_SCRIPTS}; shift; \
while [ $$# -gt 0 ]; do \
egfile=`canon "${RCD_SCRIPTS_EXAMPLEDIR}/$$1"`; shift; \
@@ -425,21 +426,25 @@ _pkginstall-postinstall-check: .PHONY
done; \
set args ${CONF_FILES}; shift; \
while [ $$# -gt 0 ]; do \
+ needargs CONF_FILES 2 $$# "$$*"; \
egfile=`canon "$$1"`; shift 2; \
[ -f "$$egfile" ] || [ -c "$$egfile" ] || ${FAIL_MSG} "CONF_FILE $$egfile does not exist."; \
done; \
set args ${REQD_FILES}; shift; \
while [ $$# -gt 0 ]; do \
+ needargs REDQ_FILES 2 $$# "$$*"; \
egfile=`canon "$$1"`; shift 2; \
[ -f "$$egfile" ] || [ -c "$$egfile" ] || ${FAIL_MSG} "REQD_FILE $$egfile does not exist."; \
done; \
set args ${CONF_FILES_PERMS}; shift; \
while [ $$# -gt 0 ]; do \
+ needargs CONF_FILES_PERMS 5 $$# "$$*"; \
egfile=`canon "$$1"`; shift 5; \
[ -f "$$egfile" ] || [ -c "$$egfile" ] || ${FAIL_MSG} "CONF_FILES_PERMS $$egfile does not exist."; \
done; \
set args ${REQD_FILES_PERMS}; shift; \
while [ $$# -gt 0 ]; do \
+ needargs REQD_FILES_PERMS 5 $$# "$$*"; \
egfile=`canon "$$1"`; shift 5; \
[ -f "$$egfile" ] || [ -c "$$egfile" ] || ${FAIL_MSG} "REQD_FILES_PERMS $$egfile does not exist."; \
done