~ubuntu-branches/ubuntu/wily/phablet-tools/wily-proposed

« back to all changes in this revision

Viewing changes to phablet-shell

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Oliver Grawert, nskaggs
  • Date: 2014-09-18 11:52:02 UTC
  • mfrom: (1.1.76)
  • Revision ID: package-import@ubuntu.com-20140918115202-ahaw27031pl7e2oa
Tags: 1.1+14.10.20140918-0ubuntu1
[ Oliver Grawert ]
* 'phablet-shell: only start/stop ssh if it is not already running, do
  not wipe authorized_keys (breaks the SDK) and instead only append
  the key if it is not there yet. make sure ~/.ssh exists before
  trying to do anything with it (LP: #1355286) (LP: #1337289) (LP:
  #1326805) (LP: #1337289, #1326805, #1355286)

[ nskaggs ]
* Make phablet-test-run use only python3 and the autopilot3 binary.
  Fixes bug 1321463 and bug 1364369 (LP: #1364369, #1321463)

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    adb shell "$CMD >/dev/null"
83
83
}
84
84
 
 
85
# if sshd is already runing, do not attempt to start it
 
86
SSH_RUNNING="$(adb shell pgrep sshd)"
 
87
 
85
88
# Start ssh on the device and use port forwarding to connect to it.
86
89
# This means that we'll connect to the device through the USB cable
87
90
# and won't depend on if the device has it's wifi configured or not.
88
 
toggle_ssh true
 
91
[ -n "$SSH_RUNNING" ] || toggle_ssh true
89
92
 
90
93
for PORT in `seq 2222 2299`; do
91
94
    adb forward tcp:$PORT tcp:22 && break
99
102
 
100
103
# Copy your ssh id down to the device so you never need a password.
101
104
NEWEST_KEY=$(ls -t ~/.ssh/*.pub | grep -v -- -cert.pub | head -1)
102
 
adb push $NEWEST_KEY /home/phablet/.ssh/authorized_keys
103
 
adb shell chown phablet:phablet -R /home/phablet/.ssh/
104
 
adb shell chmod 700 /home/phablet/.ssh
105
 
adb shell chmod 600 /home/phablet/.ssh/authorized_keys
 
105
KEY_CONTENT="$(cat $NEWEST_KEY)"
 
106
 
 
107
# make sure we have a ~/.ssh/ dir before trying to write to it
 
108
adb shell "[ -d ~/.ssh ] || mkdir ~/.ssh"
 
109
 
 
110
# append the key to authorized_keys if it is not there already
 
111
adb shell "touch  ~/.ssh/authorized_keys"
 
112
if [ -z "$(adb shell "grep \"$KEY_CONTENT\" ~/.ssh/authorized_keys")" ]; then
 
113
    adb shell "echo $KEY_CONTENT >>~/.ssh/authorized_keys"
 
114
    adb shell "chmod 700 ~/.ssh"
 
115
    adb shell "chmod 600 ~/.ssh/authorized_keys"
 
116
fi
106
117
 
107
118
# Copy your bash config down to the device so you get the benefit of your
108
119
# colourful $PS1 prompt and any bash aliases that you may be used to from your
115
126
ssh $SSH_OPTS phablet@localhost
116
127
 
117
128
# turn off ssh access again
118
 
toggle_ssh false
 
129
[ -n "$SSH_RUNNING" ] || toggle_ssh false