svn commit: r415154 - head/Mk

Jonathan Anderson jonathan at FreeBSD.org
Fri May 13 20:53:11 UTC 2016


Author: jonathan (src committer)
Date: Fri May 13 20:53:10 2016
New Revision: 415154
URL: https://svnweb.freebsd.org/changeset/ports/415154

Log:
  Fix "need root" logic for PORT_DBDIR.
  
  When PORT_DBDIR is set to a user directory, we shouldn't need su to
  manipulate options. This also shouldn't depend on INSTALL_BY_USER, as
  building != installing.
  
  Approved by:	portmgr (bapt)
  Differential Revision:	https://reviews.freebsd.org/D6349

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Fri May 13 20:46:57 2016	(r415153)
+++ head/Mk/bsd.port.mk	Fri May 13 20:53:10 2016	(r415154)
@@ -5246,7 +5246,8 @@ do-config:
 	@${ECHO_MSG} "===> No options to configure"
 .else
 	@optionsdir=${OPTIONS_FILE:H}; \
-	if [ ${UID} != 0 -a -z "${INSTALL_AS_USER}" -a ! -w "${PORT_DBDIR}" ] ; then \
+	if [ ! -w "${PORT_DBDIR}" -a "`stat -f %u ${PORT_DBDIR:H}`" = 0 ]; \
+	then \
 		${ECHO_MSG} "===>  Switching to root credentials to create $${optionsdir}"; \
 		(${SU_CMD} "${SH} -c \"${MKDIR} $${optionsdir} 2> /dev/null\"") || \
 			(${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \
@@ -5282,7 +5283,8 @@ do-config:
 			${ECHO_CMD} "OPTIONS_FILE_UNSET+=$${i}" >> $${TMPOPTIONSFILE}; \
 		fi; \
 	done; \
-	if [ ${UID} != 0 -a -z "${INSTALL_AS_USER}" -a ! -w "${OPTIONS_FILE:H}" ]; then \
+	if [ ! -w "${OPTIONS_FILE:H}" -a "`stat -f %u ${OPTIONS_FILE:H}`" != ${UID} ]; \
+	then \
 		${ECHO_MSG} "===>  Switching to root credentials to write ${OPTIONS_FILE}"; \
 		${SU_CMD} "${CAT} $${TMPOPTIONSFILE} > ${OPTIONS_FILE}"; \
 		${ECHO_MSG} "===>  Returning to user credentials"; \


More information about the svn-ports-head mailing list