Merge lp:~ondrak/goget-ubuntu-touch/new-adb into lp:goget-ubuntu-touch

Proposed by Ondrej Kubik
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 222
Merged at revision: 226
Proposed branch: lp:~ondrak/goget-ubuntu-touch/new-adb
Merge into: lp:goget-ubuntu-touch
Diff against target: 68 lines (+36/-1)
1 file modified
ubuntu-device-flash/touch.go (+36/-1)
To merge this branch: bzr merge lp:~ondrak/goget-ubuntu-touch/new-adb
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+290434@code.launchpad.net

Commit message

touch: new adb support with key support.

Description of the change

updating developer-mode option
   - making developer mode work better with new adb
   - removig adb-onlock switch, which is not used anymore
   - if developer mode is enabled, provisioning device by default with local adbkeys.pub
   - adding --adb-keys option to provision with custom keys

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Looks good.

review: Approve
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~w-ondra/goget-ubuntu-touch/new-adb into lp:goget-ubuntu-touch failed. Below is the output from the failed tests.

Checking formatting
Formatting wrong in following files
diskimage/bootloader.go diskimage/common.go diskimage/core_grub.go diskimage/core_uboot.go

# we always run in a fresh dir in tarmac
export GOPATH=$(mktemp -d)
trap 'rm -rf "$GOPATH"' EXIT

# this is a hack, but not sure tarmac is golang friendly
mkdir -p $GOPATH/src/launchpad.net/goget-ubuntu-touch
cp -a . $GOPATH/src/launchpad.net/goget-ubuntu-touch
cd $GOPATH/src/launchpad.net/goget-ubuntu-touch

./run-checks

Revision history for this message
Ondrej Kubik (ondrak) wrote :

I guess it's safe to say this is false warning, considering it's complaining about files that were not touched by this MP...

> The attempt to merge lp:~w-ondra/goget-ubuntu-touch/new-adb into lp:goget-
> ubuntu-touch failed. Below is the output from the failed tests.
>
> Checking formatting
> Formatting wrong in following files
> diskimage/bootloader.go diskimage/common.go diskimage/core_grub.go
> diskimage/core_uboot.go
>
>
> # we always run in a fresh dir in tarmac
> export GOPATH=$(mktemp -d)
> trap 'rm -rf "$GOPATH"' EXIT
>
> # this is a hack, but not sure tarmac is golang friendly
> mkdir -p $GOPATH/src/launchpad.net/goget-ubuntu-touch
> cp -a . $GOPATH/src/launchpad.net/goget-ubuntu-touch
> cd $GOPATH/src/launchpad.net/goget-ubuntu-touch
>
> ./run-checks

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu-device-flash/touch.go'
2--- ubuntu-device-flash/touch.go 2015-02-10 05:51:08 +0000
3+++ ubuntu-device-flash/touch.go 2016-03-30 11:06:21 +0000
4@@ -36,6 +36,7 @@
5 Wipe bool `long:"wipe" description:"Clear all data after flashing"`
6 Serial string `long:"serial" description:"Serial of the device to operate"`
7 DeveloperMode bool `long:"developer-mode" description:"Enables developer mode after the factory reset, this is meant for automation and makes the device insecure by default (requires --password)"`
8+ AdbKeys string `long:"adb-keys" description:"Specify a local adb keys files, instead of using default ~/.android/adbkey.pub (requires --developer-mode)"`
9 DeviceTarball string `long:"device-tarball" description:"Specify a local device tarball to override the one from the server (using official Ubuntu images with different device tarballs)"`
10 CustomTarball string `long:"custom-tarball" description:"Specify a local custom tarball to override the one from the server (using official Ubuntu images with different custom tarballs)"`
11 RunScript string `long:"run-script" description:"Run a script given by path to finish the flashing process, instead of rebooting to recovery (mostly used during development to work around quirky or incomplete recovery images)"`
12@@ -79,6 +80,30 @@
13 log.Fatal("Developer mode requires --password to be set (and --wipe or --bootstrap)")
14 }
15
16+ if touchCmd.AdbKeys != "" && !touchCmd.DeveloperMode {
17+ log.Fatal("Adb keys requires --developer-mode to be set")
18+ }
19+
20+ var adbKeyPath string
21+ if touchCmd.DeveloperMode {
22+ if touchCmd.AdbKeys != "" {
23+ p, err := expandFile(touchCmd.AdbKeys)
24+ if err != nil {
25+ log.Fatalln("Issues with custom adb keys file", err)
26+ }
27+ adbKeyPath = p
28+ } else {
29+ home := os.Getenv("HOME")
30+ p, err := expandFile(filepath.Join(home, "/.android/adbkey.pub"))
31+ if err != nil {
32+ fmt.Println("WARNING: missing ~/.android/adbkey.pub, your device will not be preauthorised")
33+ } else {
34+ fmt.Println("no --adb-keys defined, using default ~/.android/adbkey.pub")
35+ adbKeyPath = p
36+ }
37+ }
38+ }
39+
40 if touchCmd.Password != "" && !touchCmd.Wipe {
41 log.Fatal("Default password setup requires --wipe or --bootstrap")
42 }
43@@ -87,6 +112,10 @@
44 fmt.Println("WARNING --developer-mode and --password are dangerous as they remove security features from your device")
45 }
46
47+ if touchCmd.AdbKeys != "" && touchCmd.DeveloperMode {
48+ fmt.Println("WARNING: --adb-keys is dangerous, potentially authorising multiple cliets to connect to your device")
49+ }
50+
51 var deviceTarballPath string
52 if touchCmd.DeviceTarball != "" {
53 p, err := expandFile(touchCmd.DeviceTarball)
54@@ -220,7 +249,13 @@
55 var enableList []string
56 if touchCmd.DeveloperMode {
57 enableList = append(enableList, "developer_mode")
58- enableList = append(enableList, "adb_onlock")
59+ // provision target device with adbkeys if available
60+ if adbKeyPath != "" {
61+ err := touchCmd.adb.Push(adbKeyPath, "/cache/recovery/adbkey.pub")
62+ if err == nil {
63+ enableList = append(enableList, "adb_keys adbkey.pub")
64+ }
65+ }
66 }
67 if touchCmd.Password != "" {
68 enableList = append(enableList, "default_password "+touchCmd.Password)

Subscribers

People subscribed via source and target branches