aboutsummaryrefslogtreecommitdiff
blob: bf6a128114b94de7aa9c5341290e53e648e4370e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
# Copyright 2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

if [ -z "${CHOST}" ] ; then
	CHOST=${0##*/}
	CHOST=${CHOST%-emerge}
fi

: ${SYSROOT=/usr/${CHOST}}
: ${PORTAGE_CONFIGROOT=${SYSROOT}}

if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
	echo "cross-emerge: CHOST is not set properly"
	exit 1
fi

: ${CBUILD=$(portageq envvar CBUILD)}

FAKEROOT=
if [ $(id -u) -ne 0 ] ; then
	type -P fakeroot >/dev/null && FAKEROOT=fakeroot
fi

exec ${FAKEROOT} emerge -q "$@"