From 5bb887ca5f46e989cd78cf76c04c71f08a656924 Mon Sep 17 00:00:00 2001
From: William Hubbs <williamh@gentoo.org>
Date: Mon, 27 Jun 2011 21:02:44 -0500
Subject: [PATCH] add mkcoreonly option

This option is to be used if you need openrc's functions such as einfo,
ewarn, eerror, etc, but you do not need the init scripts.
---
 Makefile        |    8 +++++++-
 README          |    1 +
 src/rc/Makefile |   13 +++++++++----
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index dd427d0..6bee4d9 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,11 @@
 
 include Makefile.inc
 
-SUBDIR=		conf.d etc init.d local.d man scripts sh src
+SUBDIR = etc man scripts sh src
+
+ifneq (${MKCOREONLY},yes)
+SUBDIR += conf.d init.d local.d
+endif
 
 # Build our old net foo or not
 ifeq (${MKOLDNET},yes)
@@ -18,7 +22,9 @@ SUBDIR+=	pkgconfig
 endif
 
 # We need to ensure that runlevels is done last
+ifneq (${MKCOREONLY},yes)
 SUBDIR+=	runlevels
+endif
 
 INSTALLAFTER=	_installafter
 
diff --git a/README b/README
index 5f3745c..56c6bb6 100644
--- a/README
+++ b/README
@@ -10,6 +10,7 @@ You may wish to tweak the installation with the below arguments
 PROGLDFLAGS=-static
 LIBNAME=lib64
 DESTDIR=/tmp/openrc-image
+MKCOREONLY=yes
 MKPAM=pam
 MKPKGCONFIG=no
 MKRCSYS=prefix
diff --git a/src/rc/Makefile b/src/rc/Makefile
index fc6b9aa..f8feb07 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -10,8 +10,11 @@ BINDIR=		${PREFIX}/bin
 SBINDIR=	${PREFIX}/sbin
 LINKDIR=	${LIBEXECDIR}
 
+ifneq (${MKCOREONLY},yes)
 BINLINKS=	rc-status
 SBINLINKS=	rc-service rc-update runscript start-stop-daemon
+endif
+
 RC_BINLINKS=	einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
 		eindent eoutdent esyslog eval_ecolors ewaitfile \
 		veinfo vewarn vebegin veend vewend veindent veoutdent \
@@ -83,10 +86,12 @@ install: all
 	$(call make-links,${RC_BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/bin)
 	${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
 	$(call make-links, ${RC_SBINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/sbin)
-	if test "${MKPAM}" = pam; then \
-		${INSTALL} -d ${DESTDIR}${PAMDIR}; \
-		${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
-	fi
+ifneq (${MKCOREONLY},yes)
+ifeq (${MKPAM},pam)
+	${INSTALL} -d ${DESTDIR}${PAMDIR}
+	${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon
+endif
+endif
 
 check test::
 
-- 
1.7.3.4