Date: Fri, 13 May 2016 20:53:10 +0000 (UTC) From: Jonathan Anderson <jonathan@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r415154 - head/Mk Message-ID: <201605132053.u4DKrAAt098343@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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"; \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605132053.u4DKrAAt098343>