diff options
-rw-r--r-- | mk/bsd.pkg.mk | 7 | ||||
-rw-r--r-- | mk/defaults/mk.conf | 7 | ||||
-rw-r--r-- | mk/pkginstall/bsd.pkginstall.mk | 19 |
3 files changed, 26 insertions, 7 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 8a217dc1893..8cf0e2e42d9 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1995 2014/03/03 03:21:16 obache Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1996 2014/03/11 13:45:07 jperkin Exp $ # # This file is in the public domain. # @@ -315,6 +315,11 @@ OVERRIDE_DIRDEPTH?= 2 # .include "alternatives.mk" +# Support alternative init systems. +# +INIT_SYSTEM?= rc.d +_BUILD_DEFS+= INIT_SYSTEM + # Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree # of dependencies for building, and the current target. _PKGSRC_IN?= ===${SMART_MESSAGES:D> ${.TARGET} [${PKGNAME}${_PKGSRC_DEPS}] ===} diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf index b6f1fabaab1..6b66d3acb13 100644 --- a/mk/defaults/mk.conf +++ b/mk/defaults/mk.conf @@ -1,4 +1,4 @@ -# $NetBSD: mk.conf,v 1.236 2014/03/07 15:10:33 jperkin Exp $ +# $NetBSD: mk.conf,v 1.237 2014/03/11 13:45:07 jperkin Exp $ # # This file provides default values for variables that may be overridden @@ -395,6 +395,11 @@ PKG_SYSCONFBASE?= ${PREFIX}/etc # Possible: any path you like # Default: ${PREFIX}/etc +#INIT_SYSTEM= +# This determines the type of init system to be used. +# Possible: any of: rc.d +# Default: Platform-dependent, otherwise rc.d + RCD_SCRIPTS_DIR?= /etc/rc.d # This is the system rc.d script directory in which all rc.d scripts # expected to be executed at boot-time should be found. Package views 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 |