Merge lp:~saviq/unity/8.flipped-support into lp:unity/8.0

Proposed by Michał Sawicz
Status: Merged
Approved by: Michael Zanetti
Approved revision: no longer in the source branch.
Merged at revision: 44
Proposed branch: lp:~saviq/unity/8.flipped-support
Merge into: lp:unity/8.0
Diff against target: 79 lines (+23/-5)
1 file modified
run_on_device (+23/-5)
To merge this branch: bzr merge lp:~saviq/unity/8.flipped-support
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+171061@code.launchpad.net

Commit message

Support flipped image in run_on_device.

Description of the change

Flipped images are coming!

They're coming right for us!

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Tested with old-style and with flipped image. Both, ./run_on_device -s and ./run_on_device work. Same for the adb-over-tcp check.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run_on_device'
2--- run_on_device 2013-06-12 08:46:06 +0000
3+++ run_on_device 2013-06-24 11:12:28 +0000
4@@ -15,6 +15,8 @@
5 KEYLOCK=false
6 SUDO="echo $PASSWORD | sudo -S"
7 NUM_JOBS='$(( `grep -c ^processor /proc/cpuinfo` + 1 ))'
8+FLIPPED=false
9+CHROOT_PREFIX="/data/ubuntu"
10
11 usage() {
12 echo "usage: run_on_device [OPTIONS]\n"
13@@ -35,7 +37,11 @@
14 }
15
16 exec_with_adb() {
17- adb shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
18+ if $FLIPPED; then
19+ adb shell $@
20+ else
21+ adb shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
22+ fi
23 }
24
25 adb_root() {
26@@ -45,7 +51,7 @@
27
28 install_ssh_key() {
29 ssh-keygen -R $TARGET_IP
30- HOME_DIR=/data/ubuntu/home/phablet
31+ HOME_DIR="${CHROOT_PREFIX}/home/phablet"
32 adb push ~/.ssh/id_rsa.pub $HOME_DIR/.ssh/authorized_keys
33 adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh
34 adb shell chown $USER_ID:$USER_ID $HOME_DIR/.ssh/authorized_keys
35@@ -79,14 +85,15 @@
36 }
37
38 run() {
39- SERVICEFILE="/data/ubuntu/etc/device-services"
40+ SERVICEFILE="${CHROOT_PREFIX}/etc/device-services"
41 adb shell "egrep '$BINARY|qml-phone-shell' $SERVICEFILE"
42 CONTAINS_SHELL=$?
43 if [ $CONTAINS_SHELL -eq 0 ]; then
44 echo "Modifying $SERVICEFILE on device. Old contents will be saved in $SERVICEFILE.backup"
45 adb shell cp $SERVICEFILE $SERVICEFILE.backup
46 adb shell sed -i "/$BINARY\\\\\|qml-phone-shell/d" $SERVICEFILE
47- adb shell "chroot /data/ubuntu /usr/bin/service ubuntu-session restart"
48+ if $FLIPPED; then exec_with_adb /usr/bin/service ubuntu-touch-session restart
49+ else exec_with_adb /usr/bin/service ubuntu-session restart; fi
50 fi
51 adb shell pkill qml-phone-shell
52 adb shell pkill $BINARY
53@@ -106,7 +113,8 @@
54 if [ $CONTAINS_SHELL -eq 0 ]; then
55 echo "Restoring $SERVICEFILE on device from $SERVICEFILE.backup"
56 adb shell cp $SERVICEFILE.backup $SERVICEFILE
57- adb shell "chroot /data/ubuntu /usr/bin/service ubuntu-session restart"
58+ if $FLIPPED; then exec_with_adb /usr/bin/service ubuntu-touch-session restart
59+ else exec_with_adb /usr/bin/service ubuntu-session restart; fi
60 fi
61 }
62
63@@ -130,6 +138,16 @@
64 adb_root
65 [ "${TARGET_IP}" = "127.0.0.1" ] && setup_adb_forwarding
66
67+if [ "`adb shell 'grep -q Ubuntu /etc/lsb-release 2> /dev/null && echo -n FLIPPED'`" = "FLIPPED" ]; then
68+ FLIPPED=true
69+ CHROOT_PREFIX=""
70+ if [ "${TARGET_IP}" != "127.0.0.1" ]; then
71+ echo "ERROR: Flipped image detected, adb over TCP/IP isn't supported, yet :/"
72+ echo "Unset TARGET_IP and try again."
73+ exit 2
74+ fi
75+fi
76+
77 if $SETUP; then
78 echo "Setting up environment for building shell.."
79 install_ssh_key

Subscribers

People subscribed via source and target branches

to all changes: