aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-12-02 16:21:25 -0500
committerMike Frysinger <vapier@gentoo.org>2008-12-02 16:26:21 -0500
commit6b4c5cdc60cfcab9aaa976891562150c56b916ca (patch)
tree7c30aba67b0d7485a0af3657b1077254ccc61dbd /wrappers
parentdist: set version during generation (diff)
downloadcrossdev-6b4c5cdc60cfcab9aaa976891562150c56b916ca.tar.gz
crossdev-6b4c5cdc60cfcab9aaa976891562150c56b916ca.tar.bz2
crossdev-6b4c5cdc60cfcab9aaa976891562150c56b916ca.zip
cross-emerge: deduce default CHOST from $0
Also rewrite in POSIX shell. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'wrappers')
-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 "$@"