aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwrappers/cross-emerge25
1 files changed, 16 insertions, 9 deletions
diff --git a/wrappers/cross-emerge b/wrappers/cross-emerge
index 27f10b0..bf6a128 100755
--- a/wrappers/cross-emerge
+++ b/wrappers/cross-emerge
@@ -1,19 +1,26 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
-# -solar
+if [ -z "${CHOST}" ] ; then
+ CHOST=${0##*/}
+ CHOST=${CHOST%-emerge}
+fi
+
+: ${SYSROOT=/usr/${CHOST}}
+: ${PORTAGE_CONFIGROOT=${SYSROOT}}
-[[ $CHOST == "" ]] && { echo "CHOST is not set" ; exit 1 ; }
+if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
+ echo "cross-emerge: CHOST is not set properly"
+ exit 1
+fi
-export CBUILD=$(portageq envvar CBUILD)
-export SYSROOT="/usr/${CHOST}"
-export PORTAGE_CONFIGROOT="/usr/${CHOST}"
+: ${CBUILD=$(portageq envvar CBUILD)}
FAKEROOT=
-if [[ $(id -u) != 0 ]]; then
- [[ $(type -p fakeroot) != "" ]] && FAKEROOT=fakeroot
+if [ $(id -u) -ne 0 ] ; then
+ type -P fakeroot >/dev/null && FAKEROOT=fakeroot
fi
-${FAKEROOT} emerge -q "$@"
+exec ${FAKEROOT} emerge -q "$@"