summaryrefslogtreecommitdiffstats
path: root/bin/ebuild-helpers/fowners
blob: b664ec7667677f9f73aa49408f3b5f4e534ada73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# 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

if ! ___eapi_has_prefix_variables; then
	EPREFIX= ED=${D}
fi

# 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