on xenial help sign in
various fixes after speaking with Michał

service->initctl leave ssh stopped if it was stopped

commit79af4382104bc2ac06102d7e7c2e6d71b7a0c842 authorAlbert Astals <albert.astals@canonical.com> dateMon 7 Oct 2013, 16:36 (13 years ago) parent4545068
1 file changed+14−2
run_on_device+14−2
run_on_device+14−2
@@ -1,4 +1,4 @@
1−#!/bin/sh
1+#!/bin/bash
22CODE_DIR=shell
33USER=phablet
44USER_ID=32011
@@ -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_WAS_STARTED=0
2021SSH_STARTED=0
2122
2223usage() {
@@ -35,7 +36,7 @@ usage() {
3536
3637start_ssh() {
3738 if [ $SSH_STARTED -eq 0 ]; then
38− exec_with_adb service ssh start
39+ exec_with_adb initctl start ssh
3940 SSH_STARTED=1
4041 fi
4142}
@@ -140,6 +141,14 @@ if [ "`adb shell 'grep -q Ubuntu /etc/lsb-release 2> /dev/null && echo -n FLIPPE
140141 fi
141142fi
142143
144+status_output=$(exec_with_adb initctl status ssh)
145+if [[ $status_output == "ssh start/running, process "* ]]; then
146+ SSH_WAS_STARTED=1
147+fi
148+SSH_STARTED=$SSH_WAS_STARTED
149+
150+echo "$SSH_WAS_STARTED $SSH_STARTED"
151+
143152if $SETUP; then
144153 echo "Setting up environment for building shell.."
145154 install_ssh_key
@@ -154,3 +163,6 @@ else
154163 run
155164fi
156165
166+if [ $SSH_WAS_STARTED -eq 0 ]; then
167+ exec_with_adb initctl stop ssh
168+fi