on xenial help sign in
various fixes after speaking with Michał
79af438Albert Astals
run_on_device+14−2
@@ -1,4 +1,4 @@
1−#!/bin/sh
1+#!/bin/bash
2CODE_DIR=shell
2CODE_DIR=shell
3USER=phablet
3USER=phablet
4USER_ID=32011
4USER_ID=32011
@@ -17,6 +17,7 @@ SUDO="echo $PASSWORD | sudo -S"
17NUM_JOBS='$(( `grep -c ^processor /proc/cpuinfo` + 1 ))'
17NUM_JOBS='$(( `grep -c ^processor /proc/cpuinfo` + 1 ))'
18FLIPPED=false
18FLIPPED=false
19CHROOT_PREFIX="/data/ubuntu"
19CHROOT_PREFIX="/data/ubuntu"
20+SSH_WAS_STARTED=0
20SSH_STARTED=0
21SSH_STARTED=0
21
22
22usage() {
23usage() {
@@ -35,7 +36,7 @@ usage() {
35
36
36start_ssh() {
37start_ssh() {
37 if [ $SSH_STARTED -eq 0 ]; then
38 if [ $SSH_STARTED -eq 0 ]; then
38− exec_with_adb service ssh start
39+ exec_with_adb initctl start ssh
39 SSH_STARTED=1
40 SSH_STARTED=1
40 fi
41 fi
41}
42}
@@ -140,6 +141,14 @@ if [ "`adb shell 'grep -q Ubuntu /etc/lsb-release 2> /dev/null && echo -n FLIPPE
140 fi
141 fi
141fi
142fi
142
143
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+
143if $SETUP; then
152if $SETUP; then
144 echo "Setting up environment for building shell.."
153 echo "Setting up environment for building shell.."
145 install_ssh_key
154 install_ssh_key
@@ -154,3 +163,6 @@ else
154 run
163 run
155fi
164fi
156
165
166+if [ $SSH_WAS_STARTED -eq 0 ]; then
167+ exec_with_adb initctl stop ssh
168+fi