diff options
author | rillig <rillig@pkgsrc.org> | 2007-12-06 22:03:22 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-12-06 22:03:22 +0000 |
commit | 2e6521f63c78325b43444afc57bf6a62d5286105 (patch) | |
tree | fc67548964639f5289dad33d9afdc44c8bb25e01 | |
parent | 0769a1c302a0e62ef58dd7d3ee51ad0a907a4679 (diff) | |
download | pkgsrc-2e6521f63c78325b43444afc57bf6a62d5286105.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.
-rw-r--r-- | mk/pkginstall/bsd.pkginstall.mk | 7 |
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 |