pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Add initial support for alternative init systems.
details: https://anonhg.NetBSD.org/pkgsrc/rev/055c95a82216
branches: trunk
changeset: 631628:055c95a82216
user: jperkin <jperkin%pkgsrc.org@localhost>
date: Tue Mar 11 13:45:07 2014 +0000
description:
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:
mk/bsd.pkg.mk | 7 ++++++-
mk/defaults/mk.conf | 7 ++++++-
mk/pkginstall/bsd.pkginstall.mk | 19 ++++++++++++++-----
3 files changed, 26 insertions(+), 7 deletions(-)
diffs (109 lines):
diff -r aef1aa49b760 -r 055c95a82216 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Tue Mar 11 12:16:49 2014 +0000
+++ b/mk/bsd.pkg.mk Tue Mar 11 13:45:07 2014 +0000
@@ -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 @@
#
.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 -r aef1aa49b760 -r 055c95a82216 mk/defaults/mk.conf
--- a/mk/defaults/mk.conf Tue Mar 11 12:16:49 2014 +0000
+++ b/mk/defaults/mk.conf Tue Mar 11 13:45:07 2014 +0000
@@ -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 @@
# 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 -r aef1aa49b760 -r 055c95a82216 mk/pkginstall/bsd.pkginstall.mk
--- a/mk/pkginstall/bsd.pkginstall.mk Tue Mar 11 12:16:49 2014 +0000
+++ b/mk/pkginstall/bsd.pkginstall.mk Tue Mar 11 13:45:07 2014 +0000
@@ -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_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 @@
${_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 @@
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 @@
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 @@
${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
Home |
Main Index |
Thread Index |
Old Index