aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2015-04-06 14:59:07 +0100
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2015-04-06 14:59:07 +0100
commit9ea590c4dd79f1d3f6ccad42fd4a9d632df0254c (patch)
treeb27fe5b5482787d7fe1ba0ebc71675eae136bb08 /scripts
parent7e561b6a05ce051769e66116a2812e037bad8e01 (diff)
Correctly finish even completely broken schroot sessions
This fixes BZ1416. Running "cat" or "bash" inside schroot can fail if schroot session is broken (e.g., due to sysroot problem). Change-Id: I1471622f25ba48e9d9947cc63fff2477bab9792c
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-schroot.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/test-schroot.sh b/scripts/test-schroot.sh
index 4268e2e9..488d14a8 100755
--- a/scripts/test-schroot.sh
+++ b/scripts/test-schroot.sh
@@ -273,7 +273,16 @@ if $ssh_master; then
fi
# Keep the session alive when file /dont_kill_me is present
-if $finish_session && [ x`$schroot cat /dont_keep_session` = x"1" ]; then
+if $finish_session; then
+ # Perform all operations from outside of schroot session since the inside
+ # may be completely broken (e.g., bash doesn't start).
+ schroot_location="$(ssh $target_ssh_opts $target schroot --location -c session:$profile-$port)"
+ if [ x"$(ssh $target_ssh_opts $target cat $schroot_location/dont_keep_session)" != x"1" ]; then
+ finish_session=false
+ fi
+fi
+
+if $finish_session; then
$schroot iptables -I INPUT -p tcp --dport $port -j REJECT || true
ssh $target_ssh_opts $target schroot -f -e -c session:$profile-$port | true
if [ x"${PIPESTATUS[0]}" != x"0" ]; then