~canonical-platform-qa/lrt/lrt-to-dep8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
set -x

if [ -z $1 ]; then
    echo 'Error: you must specify the serial number of the phone to flash'
    echo 'Example:'
    echo 'bash image-phone.sh <phone serial number> <password>'
    exit 1
fi

if [ -z $2 ]; then
    echo 'Error: you must specify the password'
    echo 'Example:'
    echo 'bash image-phone.sh <phone serial number> <password>'
    exit 1
fi


ANDROID_SERIAL=$1
PASSWORD=$2
target_branch=lp:~chris.gagnon/+junk/lrt2


exec_with_adb() { 
    adb -s $ANDROID_SERIAL shell "echo $PASSWORD|sudo -S $@"
}


# Install the latest requested image
adb -s $ANDROID_SERIAL wait-for-device

sudo ubuntu-device-flash --channel=ubuntu-touch/ubuntu-rtm/14.09-proposed --developer-mode --wipe --serial=$ANDROID_SERIAL --password=$PASSWORD

adb -s $ANDROID_SERIAL wait-for-device
sleep 120


phablet-config -s $ANDROID_SERIAL welcome-wizard --disable
exec_with_adb 'touch /userdata/.writable_image'
exec_with_adb 'reboot'

sleep 10
adb -s $ANDROID_SERIAL  wait-for-device
sleep 120
phablet-config -s $ANDROID_SERIAL edges-intro --disable
phablet-network -s $ANDROID_SERIAL 



phablet-test-run -s $ANDROID_SERIAL -x 'ping -c 2 launchpad.net' || phablet-test-run -s $ANDROID_SERIAL -x 'nmcli nm wifi on'


phablet-network -s $ANDROID_SERIAL 


# mpt crashes can prevent apt-get update from finishing
exec_with_adb 'apt-get update'
sleep 10
exec_with_adb 'apt-get update'
sleep 10
exec_with_adb 'apt-get update'
sleep 10

exec_with_adb 'apt-get install bzr -y'
exec_with_adb 'apt-get install unity8-autopilot -y'
exec_with_adb 'apt-get install gdb gdb-multiarch apport-retrace python3-apport python3-requests-oauthlib -y'
exec_with_adb 'apt-get install imagemagick -y'
exec_with_adb 'touch /etc/apport/autoreport'
exec_with_adb 'mkdir -p /var/lib/apport'
exec_with_adb 'touch /var/lib/apport/autoreport'
exec_with_adb "sed -i 's/report_crashes=false/report_crashes=true/g' /etc/default/whoopsie"

adb -s $ANDROID_SERIAL push get_sudo.sh /home/phablet/get_sudo.sh
adb -s $ANDROID_SERIAL shell chmod +x /home/phablet/get_sudo.sh
exec_with_adb /home/phablet/get_sudo.sh

phablet-click-test-setup -s $ANDROID_SERIAL --distribution ubuntu-rtm --series 14.09

phablet-config -s $ANDROID_SERIAL autopilot --dbus-probe enable

phablet-test-run -s $ANDROID_SERIAL -x "mkdir -p autopilot && cd autopilot && rm -rf lrt"

phablet-test-run -s $ANDROID_SERIAL -x "cd autopilot && bzr branch $target_branch lrt -Ossl.cert_reqs=none || bzr branch $target_branch lrt -Ossl.cert_reqs=none || bzr branch $target_branch" lrt -Ossl.cert_reqs=none