on xenial help sign in
Make sure we have ssh started when we need it
commit92b7886560eec4f6cb59440547e70bc958c429bd authorAlbert Astals <albert.astals@canonical.com> dateMon 7 Oct 2013, 15:44 (13 years ago) parent64e5148
1 file changed+11−1
run_on_device+11−1
run_on_device+11−1
@@ -17,6 +17,7 @@ SUDO="echo $PASSWORD | sudo -S"
1717NUM_JOBS='$(( `grep -c ^processor /proc/cpuinfo` + 1 ))'
1818FLIPPED=false
1919CHROOT_PREFIX="/data/ubuntu"
20+SSH_STARTED=0
2021
2122usage() {
2223 echo "usage: run_on_device [OPTIONS]\n"
@@ -32,7 +33,16 @@ usage() {
3233 exit 1
3334}
3435
36+start_ssh() {
37+ if [ $SSH_STARTED -eq 0 ]; then
38+ exec_with_adb service ssh start
39+ SSH_STARTED=1
40+ fi
41+}
42+
3543exec_with_ssh() {
44+ start_ssh
45+
3646 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -t $USER@$TARGET_IP -p $TARGET_SSH_PORT sudo -u $USER -i bash -ic \"$@\"
3747}
3848
@@ -66,7 +76,6 @@ setup_adb_forwarding() {
6676
6777install_dependencies() {
6878 exec_with_adb rm /etc/init/ssh.override
69− exec_with_adb service ssh start
7079 exec_with_adb apt-get update
7180 exec_with_ssh $SUDO apt-get -y install build-essential rsync bzr ccache gdb ninja-build devscripts equivs
7281}
@@ -74,6 +83,7 @@ install_dependencies() {
7483sync_code() {
7584 [ -e .bzr ] && bzr export --uncommitted --format=dir /tmp/$CODE_DIR
7685 [ -e .git ] && git checkout-index -a -f --prefix=/tmp/$CODE_DIR/
86+ start_ssh
7787 rsync -crlOzv --delete --exclude builddir -e "ssh -p $TARGET_SSH_PORT -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" /tmp/$CODE_DIR/ $USER@$TARGET_IP:$CODE_DIR/
7888 rm -rf /tmp/$CODE_DIR
7989}