aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2015-04-06 12:39:04 +0100
committerRobert Savoye <rob.savoye@linaro.org>2015-04-07 21:22:08 +0000
commit0f47c3d1bb1ca9412883f6a40680357f74296cf6 (patch)
tree96745af4c984a85e2b678f1961a02a4457b860c4 /scripts
parentd8c6cf83f59906257de4e32b80872811a4cfda80 (diff)
Enable uname substitution in schroot sessions
This is a handy trick when building native old-gen toolchains on new-gen machines. Change-Id: I6f97bfa8133b994dad641e3c497b4a5a7ee77d84
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-schroot.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/test-schroot.sh b/scripts/test-schroot.sh
index 447df314..6f7bf685 100755
--- a/scripts/test-schroot.sh
+++ b/scripts/test-schroot.sh
@@ -17,8 +17,9 @@ target_ssh_opts=""
host_ssh_opts=""
profile="tcwg-test"
multilib_path="lib"
+uname=""
-while getopts "a:bd:e:fh:l:mo:p:P:qv" OPTION; do
+while getopts "a:bd:e:fh:l:mo:p:P:qu:v" OPTION; do
case $OPTION in
a) arch=$OPTARG ;;
b) begin_session=true ;;
@@ -32,6 +33,7 @@ while getopts "a:bd:e:fh:l:mo:p:P:qv" OPTION; do
p) host_ssh_opts="$OPTARG" ;;
P) profile="$OPTARG" ;;
q) exec > /dev/null ;;
+ u) uname="$OPTARG" ;;
v) set -x ;;
esac
done
@@ -246,6 +248,18 @@ EOF
echo $target:$port installed sysroot $sysroot
fi
+if [ x"$uname" != x"" ]; then
+ old_uname="$($rsh root@$target "uname -m")"
+ $rsh root@$target "mv /bin/uname /bin/uname.real"
+ $rsh root@$target "cat > /bin/uname" <<EOF
+#!/bin/bash
+
+/bin/uname.real "\$@" | sed -e "s/$old_uname/$uname/g"
+exit \${PIPESTATUS[0]}
+EOF
+ $rsh root@$target "chmod a+x /bin/uname"
+fi
+
if $ssh_master; then
ssh $orig_target_ssh_opts -o Port=$port -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -fMN $target
fi