Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Sep 2013 13:38:07 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r328130 - head/Mk
Message-ID:  <201309241338.r8ODc7cA001853@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Tue Sep 24 13:38:07 2013
New Revision: 328130
URL: http://svnweb.freebsd.org/changeset/ports/328130

Log:
  Allow packaging as a user for stage ready ports
  If you really root then you have to define NEED_ROOT in your port Makefile

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Tue Sep 24 13:30:45 2013	(r328129)
+++ head/Mk/bsd.port.mk	Tue Sep 24 13:38:07 2013	(r328130)
@@ -4111,12 +4111,14 @@ create-users-groups:
 	fi
 	@IFS=":"; ${GREP} -h ^${_group}: ${GID_FILES} | head -n 1 | while read group foo gid members; do \
 		gid=$$(($$gid+${GID_OFFSET})); \
+		if [ "${NO_STAGE}" = "yes" ]; then \
 		if ! ${PW} groupshow $$group >/dev/null 2>&1; then \
 			${ECHO_MSG} "Creating group \`$$group' with gid \`$$gid'."; \
 			${PW} groupadd $$group -g $$gid; \
 		else \
 			${ECHO_MSG} "Using existing group \`$$group'."; \
 		fi; \
+		fi ; \
 		${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then \
 			echo \"Creating group '$$group' with gid '$$gid'.\"; \
 			${PW} groupadd $$group -g $$gid; else echo \"Using existing group '$$group'.\"; fi" >> ${TMPPLIST}; \
@@ -4140,6 +4142,7 @@ create-users-groups:
 		gid=$$(($$gid+${GID_OFFSET})); \
 		class="$${class:+-L }$$class"; \
 		homedir=$$(echo $$homedir | sed "s|^/usr/local|${PREFIX}|"); \
+		if [ "${NO_STAGE}" = "yes" ]; then \
 		if ! ${PW} usershow $$login >/dev/null 2>&1; then \
 			${ECHO_MSG}  "Creating user \`$$login' with uid \`$$uid'."; \
 			eval ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \
@@ -4147,6 +4150,7 @@ create-users-groups:
 		else \
 			${ECHO_MSG} "Using existing user \`$$login'."; \
 		fi; \
+		fi; \
 		${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then \
 			echo \"Creating user '$$login' with uid '$$uid'.\"; \
 			${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \
@@ -4291,10 +4295,17 @@ _BUILD_SEQ=		build-message pre-build pre
 _STAGE_DEP=		build
 _STAGE_SEQ=		stage-message stage-dir run-depends lib-depends apply-slist pre-install generate-plist \
 				pre-su-install
+.if defined(NEED_ROOT)
 _STAGE_SUSEQ=	create-users-groups do-install post-install post-stage compress-man \
 				install-rc-script install-ldconfig-file install-license \
 				install-desktop-entries add-plist-info add-plist-docs add-plist-examples \
 				add-plist-data add-plist-post fix-plist-sequence
+.else
+_STAGE_SEQ+=	create-users-groups do-install post-install post-stage compress-man \
+				install-rc-script install-ldconfig-file install-license \
+				install-desktop-entries add-plist-info add-plist-docs add-plist-examples \
+				add-plist-data add-plist-post fix-plist-sequence
+.endif
 .if defined(WITH_PKGNG)
 _INSTALL_DEP=	stage
 _INSTALL_SEQ=	install-message run-depends lib-depends
@@ -4564,7 +4575,7 @@ deinstall-all:
 
 .if !target(do-clean)
 do-clean:
-.if !defined(NO_STAGE) && ${UID} != 0 && !defined(INSTALL_AS_USER) && exists(${STAGE_COOKIE})
+.if !defined(NO_STAGE) && defined(NEED_ROOT) && ${UID} != 0 && !defined(INSTALL_AS_USER) && exists(${STAGE_COOKIE})
 	@${ECHO_MSG} "===>  Switching to root credentials for '${.TARGET}' target"
 	@cd ${.CURDIR} && \
 		${SU_CMD} "${MAKE} ${.TARGET}"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309241338.r8ODc7cA001853>