diff options
author | jperkin <jperkin@pkgsrc.org> | 2014-03-11 13:45:07 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2014-03-11 13:45:07 +0000 |
commit | 76ac67f79ab2db3505e1a973a83a4eaf36567eb1 (patch) | |
tree | c6486a0debd799859e125a135164078c745000b9 /mk/pkginstall | |
parent | 7371d6e4094e1968d55a97ed12ce5142d0d6ba7e (diff) | |
download | pkgsrc-76ac67f79ab2db3505e1a973a83a4eaf36567eb1.tar.gz |
Add initial support for alternative init systems.
This commit introduces an INIT_SYSTEM variable which will determine the
type of init system to be used on the target system, supporting "rc.d"
at this time.
The pkginstall infrastructure is changed to only install RCD_SCRIPTS if
INIT_SYSTEM is set to "rc.d", and PLIST entries for rc.d scripts are
now handled automatically based on RCD_SCRIPTS.
Diffstat (limited to 'mk/pkginstall')
-rw-r--r-- | mk/pkginstall/bsd.pkginstall.mk | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/mk/pkginstall/bsd.pkginstall.mk b/mk/pkginstall/bsd.pkginstall.mk index f4c6cd89f2b..6ff801f8e56 100644 --- a/mk/pkginstall/bsd.pkginstall.mk +++ b/mk/pkginstall/bsd.pkginstall.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkginstall.mk,v 1.57 2012/07/09 21:56:38 wiz Exp $ +# $NetBSD: bsd.pkginstall.mk,v 1.58 2014/03/11 13:45:07 jperkin Exp $ # # This Makefile fragment is included by bsd.pkg.mk and implements the # common INSTALL/DEINSTALL scripts framework. To use the pkginstall @@ -503,13 +503,20 @@ _INSTALL_FILES_DATAFILE= ${_PKGINSTALL_DIR}/files-data _INSTALL_UNPACK_TMPL+= ${_INSTALL_FILES_FILE} _INSTALL_DATA_TMPL+= ${_INSTALL_FILES_DATAFILE} +# Only generate init scripts if we are using rc.d +_INSTALL_RCD_SCRIPTS= # empty + +.if ${INIT_SYSTEM} == "rc.d" +_INSTALL_RCD_SCRIPTS= ${RCD_SCRIPTS} +.endif + privileged-install-hook: _pkginstall-postinstall-check _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; \ + set args ${_INSTALL_RCD_SCRIPTS}; shift; \ while [ $$# -gt 0 ]; do \ egfile=`canon "${RCD_SCRIPTS_EXAMPLEDIR}/$$1"`; shift; \ [ -f "$$egfile" ] || [ -c "$$egfile" ] || ${FAIL_MSG} "RCD_SCRIPT $$egfile does not exist."; \ @@ -542,7 +549,7 @@ _pkginstall-postinstall-check: .PHONY ${_INSTALL_FILES_DATAFILE}: ${RUN}${MKDIR} ${.TARGET:H} ${RUN}${_FUNC_STRIP_PREFIX}; \ - set -- dummy ${RCD_SCRIPTS}; shift; \ + set -- dummy ${_INSTALL_RCD_SCRIPTS}; shift; \ exec 1>>${.TARGET}; \ while ${TEST} $$# -gt 0; do \ script="$$1"; shift; \ @@ -664,7 +671,7 @@ ${_INSTALL_DIRS_DATAFILE}: esac ${RUN} \ exec 1>>${.TARGET}; \ - case ${RCD_SCRIPTS:M*:Q}"" in \ + case ${_INSTALL_RCD_SCRIPTS:M*:Q}"" in \ "") ;; \ *) ${ECHO} "# DIR: ${RCD_SCRIPTS_DIR:S/${PREFIX}\///} m" ;; \ esac @@ -1172,7 +1179,7 @@ generate-rcd-scripts: # do nothing post-install: install-rcd-scripts install-rcd-scripts: # do nothing -.for _script_ in ${RCD_SCRIPTS} +.for _script_ in ${_INSTALL_RCD_SCRIPTS} RCD_SCRIPT_SRC.${_script_}?= ${FILESDIR}/${_script_}.sh RCD_SCRIPT_WRK.${_script_}?= ${WRKDIR}/${_script_} @@ -1192,6 +1199,8 @@ install-rcd-${_script_}: ${RCD_SCRIPT_WRK.${_script_}} ${DESTDIR}${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/${_script_}; \ fi . endif +GENERATE_PLIST+= ${ECHO} ${RCD_SCRIPTS_EXAMPLEDIR}/${_script_}; +PRINT_PLIST_AWK+= /^${RCD_SCRIPTS_EXAMPLEDIR:S|/|\\/|g}\/${_script_}/ { next; } .endfor _PKGINSTALL_TARGETS+= acquire-pkginstall-lock |