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
=== modified file 'ubuntu-device-flash/touch.go'
--- ubuntu-device-flash/touch.go 2015-02-10 05:51:08 +0000
+++ ubuntu-device-flash/touch.go 2016-03-30 11:06:21 +0000
@@ -36,6 +36,7 @@
36 Wipe bool `long:"wipe" description:"Clear all data after flashing"`36 Wipe bool `long:"wipe" description:"Clear all data after flashing"`
37 Serial string `long:"serial" description:"Serial of the device to operate"`37 Serial string `long:"serial" description:"Serial of the device to operate"`
38 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)"`38 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)"`
39 AdbKeys string `long:"adb-keys" description:"Specify a local adb keys files, instead of using default ~/.android/adbkey.pub (requires --developer-mode)"`
39 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)"`40 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)"`
40 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)"`41 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)"`
41 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)"`42 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)"`
@@ -79,6 +80,30 @@
79 log.Fatal("Developer mode requires --password to be set (and --wipe or --bootstrap)")80 log.Fatal("Developer mode requires --password to be set (and --wipe or --bootstrap)")
80 }81 }
8182
83 if touchCmd.AdbKeys != "" && !touchCmd.DeveloperMode {
84 log.Fatal("Adb keys requires --developer-mode to be set")
85 }
86
87 var adbKeyPath string
88 if touchCmd.DeveloperMode {
89 if touchCmd.AdbKeys != "" {
90 p, err := expandFile(touchCmd.AdbKeys)
91 if err != nil {
92 log.Fatalln("Issues with custom adb keys file", err)
93 }
94 adbKeyPath = p
95 } else {
96 home := os.Getenv("HOME")
97 p, err := expandFile(filepath.Join(home, "/.android/adbkey.pub"))
98 if err != nil {
99 fmt.Println("WARNING: missing ~/.android/adbkey.pub, your device will not be preauthorised")
100 } else {
101 fmt.Println("no --adb-keys defined, using default ~/.android/adbkey.pub")
102 adbKeyPath = p
103 }
104 }
105 }
106
82 if touchCmd.Password != "" && !touchCmd.Wipe {107 if touchCmd.Password != "" && !touchCmd.Wipe {
83 log.Fatal("Default password setup requires --wipe or --bootstrap")108 log.Fatal("Default password setup requires --wipe or --bootstrap")
84 }109 }
@@ -87,6 +112,10 @@
87 fmt.Println("WARNING --developer-mode and --password are dangerous as they remove security features from your device")112 fmt.Println("WARNING --developer-mode and --password are dangerous as they remove security features from your device")
88 }113 }
89114
115 if touchCmd.AdbKeys != "" && touchCmd.DeveloperMode {
116 fmt.Println("WARNING: --adb-keys is dangerous, potentially authorising multiple cliets to connect to your device")
117 }
118
90 var deviceTarballPath string119 var deviceTarballPath string
91 if touchCmd.DeviceTarball != "" {120 if touchCmd.DeviceTarball != "" {
92 p, err := expandFile(touchCmd.DeviceTarball)121 p, err := expandFile(touchCmd.DeviceTarball)
@@ -220,7 +249,13 @@
220 var enableList []string249 var enableList []string
221 if touchCmd.DeveloperMode {250 if touchCmd.DeveloperMode {
222 enableList = append(enableList, "developer_mode")251 enableList = append(enableList, "developer_mode")
223 enableList = append(enableList, "adb_onlock")252 // provision target device with adbkeys if available
253 if adbKeyPath != "" {
254 err := touchCmd.adb.Push(adbKeyPath, "/cache/recovery/adbkey.pub")
255 if err == nil {
256 enableList = append(enableList, "adb_keys adbkey.pub")
257 }
258 }
224 }259 }
225 if touchCmd.Password != "" {260 if touchCmd.Password != "" {
226 enableList = append(enableList, "default_password "+touchCmd.Password)261 enableList = append(enableList, "default_password "+touchCmd.Password)

Subscribers

People subscribed via source and target branches