fowners: return success for prefix if EUID != 0
authorZac Medico <zmedico@gentoo.org>
Thu, 29 Mar 2012 22:25:23 +0000 (15:25 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 29 Mar 2012 22:25:23 +0000 (15:25 -0700)
This is based on a patch by Jeremy Olexa from bug #409893.

bin/ebuild-helpers/fowners

index a5a28f2fb08231f42cbcd476a91876ce306d22ed..a213c9eb128d20d5825b8d022a85d4140c082d17 100755 (executable)
@@ -1,16 +1,22 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 [[ " ${FEATURES} " == *" force-prefix "* ]] || \
-       case "$EAPI" in 0|1|2) ED=${D} ;; esac
+       case "$EAPI" in 0|1|2) EPREFIX= ED=${D} ;; esac
 
 # we can't prefix all arguments because
 # chown takes random options
 slash="/"
 chown "${@/#${slash}/${ED}${slash}}"
 ret=$?
+
+if [[ ${ret} != 0 && -n ${EPREFIX} && ${EUID} != 0 ]] ; then
+       ewarn "fowners failure ignored in Prefix with non-privileged user"
+       exit 0
+fi
+
 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
 exit $ret