From owner-svn-ports-head@FreeBSD.ORG Sun Dec 28 19:00:39 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C48D4B55; Sun, 28 Dec 2014 19:00:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B07442FF0; Sun, 28 Dec 2014 19:00:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBSJ0dJZ015725; Sun, 28 Dec 2014 19:00:39 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBSJ0dVG015724; Sun, 28 Dec 2014 19:00:39 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201412281900.sBSJ0dVG015724@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 28 Dec 2014 19:00:39 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r375739 - head/Mk X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Dec 2014 19:00:39 -0000 Author: bapt Date: Sun Dec 28 19:00:38 2014 New Revision: 375739 URL: https://svnweb.freebsd.org/changeset/ports/375739 QAT: https://qat.redports.org/buildarchive/r375739/ Log: Allow to work with options as a regular user Modified: head/Mk/bsd.port.mk Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Sun Dec 28 18:42:49 2014 (r375738) +++ head/Mk/bsd.port.mk Sun Dec 28 19:00:38 2014 (r375739) @@ -5446,24 +5446,22 @@ do-config: .if empty(ALL_OPTIONS) && empty(OPTIONS_SINGLE) && empty(OPTIONS_MULTI) && empty(OPTIONS_RADIO) && empty(OPTIONS_GROUP) @${ECHO_MSG} "===> No options to configure" .else -.if ${UID} != 0 && !defined(INSTALL_AS_USER) - @optionsdir=${OPTIONS_FILE}; optionsdir=$${optionsdir%/*}; \ - oldoptionsdir=${OPTIONSFILE}; oldoptionsdir=$${oldoptionsdir%/*}; \ - ${ECHO_MSG} "===> Switching to root credentials to create $${optionsdir}"; \ - (${SU_CMD} "${SH} -c \"if [ -d $${oldoptionsdir} -a ! -d $${optionsdir} ]; then ${MV} $${oldoptionsdir} $${optionsdir}; elif [ -d $${oldoptionsdir} -a -d $${optionsdir} ]; then ${RM} -rf $${oldoptionsdir} ; fi ; ${MKDIR} $${optionsdir} 2> /dev/null\"") || \ - (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \ - ${ECHO_MSG} "===> Returning to user credentials" -.else - @optionsdir=${OPTIONS_FILE}; optionsdir=$${optionsdir%/*}; \ - oldoptionsdir=${OPTIONSFILE}; oldoptionsdir=$${oldoptionsdir%/*}; \ + @optionsdir=${OPTIONS_FILE:H}; \ + oldoptionsdir=${OPTIONSFILE:H}; \ + if [ ${UID} != 0 -a -z "${INSTALL_AS_USER}" -a ! -w "${PORT_DBDIR}" ] ; then \ + ${ECHO_MSG} "===> Switching to root credentials to create $${optionsdir}"; \ + (${SU_CMD} "${SH} -c \"if [ -d $${oldoptionsdir} -a ! -d $${optionsdir} ]; then ${MV} $${oldoptionsdir} $${optionsdir}; elif [ -d $${oldoptionsdir} -a -d $${optionsdir} ]; then ${RM} -rf $${oldoptionsdir} ; fi ; ${MKDIR} $${optionsdir} 2> /dev/null\"") || \ + (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \ + ${ECHO_MSG} "===> Returning to user credentials" ; \ + else \ if [ -d $${oldoptionsdir} -a ! -d $${optionsdir} ]; then \ ${MV} $${oldoptionsdir} $${optionsdir}; \ elif [ -d $${oldoptionsdir} -a -d $${optionsdir} ]; then \ ${RM} -rf $${oldoptionsdir} ; \ fi ; \ ${MKDIR} $${optionsdir} 2> /dev/null || \ - (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1) -.endif + (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1) ; \ + fi @TMPOPTIONSFILE=$$(mktemp -t portoptions); \ trap "${RM} -f $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \ ${SETENV} ${D4P_ENV} ${SH} ${SCRIPTSDIR}/dialog4ports.sh $${TMPOPTIONSFILE} || { \ @@ -5491,7 +5489,7 @@ do-config: ${ECHO_CMD} "OPTIONS_FILE_UNSET+=$${i}" >> $${TMPOPTIONSFILE}; \ fi; \ done; \ - if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ + if [ ${UID} != 0 -a -z "${INSTALL_AS_USER}" -a ! -w "${OPTIONS_FILE:H}" ]; then \ ${ECHO_MSG} "===> Switching to root credentials to write ${OPTIONS_FILE}"; \ ${SU_CMD} "${CAT} $${TMPOPTIONSFILE} > ${OPTIONS_FILE}"; \ ${ECHO_MSG} "===> Returning to user credentials"; \ @@ -5581,7 +5579,7 @@ rmconfig: .if exists(${OPTIONSFILE}) -@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \ optionsdir=${OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ - if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ + if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" -a ! -w "${OPTIONSFILE}" ]; then \ ${ECHO_MSG} "===> Switching to root credentials to remove ${OPTIONSFILE} and $${optionsdir}"; \ ${SU_CMD} "${RM} -f ${OPTIONSFILE} ; \ ${RMDIR} $${optionsdir}"; \ @@ -5594,7 +5592,7 @@ rmconfig: .if exists(${OPTIONS_FILE}) -@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \ optionsdir=${OPTIONS_FILE}; optionsdir=$${optionsdir%/*}; \ - if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ + if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" -a ! -w "${OPTIONS_FILE}" ]; then \ ${ECHO_MSG} "===> Switching to root credentials to remove ${OPTIONS_FILE} and $${optionsdir}"; \ ${SU_CMD} "${RM} -f ${OPTIONS_FILE} ; \ ${RMDIR} $${optionsdir}"; \