Merge lp:~sergiusens/goget-ubuntu-touch/built_using_for_do into lp:goget-ubuntu-touch

Proposed by Sergio Schvezov
Status: Superseded
Proposed branch: lp:~sergiusens/goget-ubuntu-touch/built_using_for_do
Merge into: lp:goget-ubuntu-touch
Diff against target: 243 lines (+150/-12)
9 files modified
debian/changelog (+7/-0)
debian/control (+9/-0)
debian/rules (+1/-0)
debian/ubuntu-device-do.install (+1/-0)
ubuntu-device-do/factory_reset.go (+69/-0)
ubuntu-device-do/main.go (+38/-0)
ubuntu-device-flash/args.go (+1/-0)
ubuntu-device-flash/main.go (+6/-1)
ubuntuimage/images.go (+18/-11)
To merge this branch: bzr merge lp:~sergiusens/goget-ubuntu-touch/built_using_for_do
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+223647@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-18.

Description of the change

debian/control: add Built-Using for ubuntu-device-do

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-06-10 16:12:34 +0000
+++ debian/changelog 2014-06-18 20:51:44 +0000
@@ -1,3 +1,10 @@
1goget-ubuntu-touch (0.3-0ubuntu1) UNRELEASED; urgency=medium
2
3 * ubuntu-touch-do: new tool to interact with ubuntu devices.
4 * ubuntu-device-flash: option to flash with developer mode enabled.
5
6 -- Sergio Schvezov <sergio.schvezov@canonical.com> Fri, 30 May 2014 09:28:52 -0300
7
1goget-ubuntu-touch (0.2+14.10.20140610-0ubuntu1) utopic; urgency=low8goget-ubuntu-touch (0.2+14.10.20140610-0ubuntu1) utopic; urgency=low
29
3 [ Dimitri John Ledkov ]10 [ Dimitri John Ledkov ]
411
=== modified file 'debian/control'
--- debian/control 2014-03-10 13:03:23 +0000
+++ debian/control 2014-06-18 20:51:44 +0000
@@ -24,6 +24,15 @@
24 bootstrapping from fastboot or reflashing from an already24 bootstrapping from fastboot or reflashing from an already
25 supported device.25 supported device.
2626
27Package: ubuntu-device-do
28Architecture: any
29Depends: android-tools-adb,
30 ${misc:Depends},
31 ${shlibs:Depends},
32Built-Using: ${misc:Built-Using}
33Description: Tool to interact with Ubuntu Touch devices
34 Use this tool to interact with your Ubuntu Touch device
35
27Package: ubuntu-emulator36Package: ubuntu-emulator
28Architecture: i386 amd6437Architecture: i386 amd64
29Depends: ubuntu-emulator-runtime,38Depends: ubuntu-emulator-runtime,
3039
=== modified file 'debian/rules'
--- debian/rules 2014-01-09 17:42:55 +0000
+++ debian/rules 2014-06-18 20:51:44 +0000
@@ -12,3 +12,4 @@
12 rm -rf ${CURDIR}/debian/tmp/usr/bin/abootimg-extract12 rm -rf ${CURDIR}/debian/tmp/usr/bin/abootimg-extract
13 rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-emulator13 rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-emulator
14 rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-device-flash14 rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-device-flash
15 rm -rf ${CURDIR}/debian/tmp/usr/share/gocode/src/launchpad.net/goget-ubuntu-touch/ubuntu-device-do
1516
=== added file 'debian/ubuntu-device-do.install'
--- debian/ubuntu-device-do.install 1970-01-01 00:00:00 +0000
+++ debian/ubuntu-device-do.install 2014-06-18 20:51:44 +0000
@@ -0,0 +1,1 @@
1usr/bin/ubuntu-device-do
02
=== added directory 'ubuntu-device-do'
=== added file 'ubuntu-device-do/factory_reset.go'
--- ubuntu-device-do/factory_reset.go 1970-01-01 00:00:00 +0000
+++ ubuntu-device-do/factory_reset.go 2014-06-18 20:51:44 +0000
@@ -0,0 +1,69 @@
1//
2// ubuntu-device-do - Tool to send commands to an Ubuntu device
3//
4// Copyright (c) 2013 Canonical Ltd.
5//
6// Written by Sergio Schvezov <sergio.schvezov@canonical.com>
7//
8package main
9
10// This program is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License version 3, as published
12// by the Free Software Foundation.
13//
14// This program is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranties of
16// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17// PURPOSE. See the GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License along
20// with this program. If not, see <http://www.gnu.org/licenses/>.
21
22import (
23 "fmt"
24
25 "log"
26
27 "launchpad.net/goget-ubuntu-touch/devices"
28 "launchpad.net/goget-ubuntu-touch/ubuntuimage"
29)
30
31type FactoryResetCmd struct {
32 DeveloperMode bool `long:"developer-mode" description:"Enables developer mode after the factory reset"`
33 Serial string `long:"serial" description:"Serial of the device to operate"`
34}
35
36var factoryResetCmd FactoryResetCmd
37
38func init() {
39 parser.AddCommand("factory-reset",
40 "Resets to stock install",
41 "Resets a device to its stock install with the possibility to enable developer mode by default",
42 &factoryResetCmd)
43}
44
45func (factoryResetCmd *FactoryResetCmd) Execute(args []string) error {
46 var enableList []string
47 if factoryResetCmd.DeveloperMode {
48 enableList = append(enableList, "developer_mode")
49 }
50 //files: nil, files location: "", wipe: true, enable: enableList
51 ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(nil, "", true, enableList)
52 if err != nil {
53 return fmt.Errorf("cannot create commands file: %s", err)
54 }
55
56 adb, err := devices.NewUbuntuDebugBridge()
57 if err != nil {
58 log.Fatal(err)
59 }
60 if factoryResetCmd.Serial != "" {
61 adb.SetSerial(factoryResetCmd.Serial)
62 }
63 if err := adb.Push(ubuntuCommands, "/cache/recovery/ubuntu_command"); err != nil {
64 return err
65 }
66 fmt.Println("Rebooting to finish factory reset")
67 adb.RebootRecovery()
68 return nil
69}
070
=== added file 'ubuntu-device-do/main.go'
--- ubuntu-device-do/main.go 1970-01-01 00:00:00 +0000
+++ ubuntu-device-do/main.go 2014-06-18 20:51:44 +0000
@@ -0,0 +1,38 @@
1//
2// ubuntu-device-do - Tool to send commands to an Ubuntu device
3//
4// Copyright (c) 2013 Canonical Ltd.
5//
6// Written by Sergio Schvezov <sergio.schvezov@canonical.com>
7//
8package main
9
10// This program is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License version 3, as published
12// by the Free Software Foundation.
13//
14// This program is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranties of
16// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17// PURPOSE. See the GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License along
20// with this program. If not, see <http://www.gnu.org/licenses/>.
21
22import (
23 "os"
24
25 flags "github.com/jessevdk/go-flags"
26)
27
28var parser = flags.NewParser(nil, flags.Default)
29
30func init() {
31
32}
33
34func main() {
35 if _, err := parser.Parse(); err != nil {
36 os.Exit(1)
37 }
38}
039
=== modified file 'ubuntu-device-flash/args.go'
--- ubuntu-device-flash/args.go 2014-05-15 13:21:24 +0000
+++ ubuntu-device-flash/args.go 2014-06-18 20:51:44 +0000
@@ -35,6 +35,7 @@
35 Server string `long:"server" description:"Use a different image server"`35 Server string `long:"server" description:"Use a different image server"`
36 CleanCache bool `long:"clean-cache" description:"Cleans up cache with all downloaded bits"`36 CleanCache bool `long:"clean-cache" description:"Cleans up cache with all downloaded bits"`
37 TLSSkipVerify bool `long:"tls-skip-verify" description:"Skip TLS certificate validation"`37 TLSSkipVerify bool `long:"tls-skip-verify" description:"Skip TLS certificate validation"`
38 DeveloperMode bool `long:"developer-mode" description:"Enables developer mode after the factory reset"`
38 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)"`39 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)"`
39}40}
4041
4142
=== modified file 'ubuntu-device-flash/main.go'
--- ubuntu-device-flash/main.go 2014-05-27 19:02:35 +0000
+++ ubuntu-device-flash/main.go 2014-06-18 20:51:44 +0000
@@ -180,7 +180,12 @@
180 for i := 0; i < totalFiles; i++ {180 for i := 0; i < totalFiles; i++ {
181 <-done181 <-done
182 }182 }
183 ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(image.Files, cacheDir, args.Wipe)183
184 var enableList []string
185 if args.DeveloperMode {
186 enableList = append(enableList, "developer_mode")
187 }
188 ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(image.Files, cacheDir, args.Wipe, enableList)
184 if err != nil {189 if err != nil {
185 log.Fatal("Cannot create commands file")190 log.Fatal("Cannot create commands file")
186 }191 }
187192
=== modified file 'ubuntuimage/images.go'
--- ubuntuimage/images.go 2014-04-16 15:01:28 +0000
+++ ubuntuimage/images.go 2014-06-18 20:51:44 +0000
@@ -56,7 +56,7 @@
56mount system56mount system
57`57`
5858
59func GetUbuntuCommands(files []File, downloadDir string, wipe bool) (commandsFile string, err error) {59func GetUbuntuCommands(files []File, downloadDir string, wipe bool, enable []string) (commandsFile string, err error) {
60 tmpFile, err := ioutil.TempFile(downloadDir, "ubuntu_commands")60 tmpFile, err := ioutil.TempFile(downloadDir, "ubuntu_commands")
61 if err != nil {61 if err != nil {
62 return commandsFile, err62 return commandsFile, err
@@ -70,16 +70,23 @@
70 if wipe {70 if wipe {
71 writer.WriteString("format data\n")71 writer.WriteString("format data\n")
72 }72 }
73 writer.WriteString(commandsStart)73 if files != nil {
74 order := func(f1, f2 *File) bool {74 writer.WriteString(commandsStart)
75 return f1.Order < f2.Order75 order := func(f1, f2 *File) bool {
76 }76 return f1.Order < f2.Order
77 By(order).Sort(files)77 }
78 for _, file := range files {78 By(order).Sort(files)
79 writer.WriteString(79 for _, file := range files {
80 fmt.Sprintf("update %s %s\n", filepath.Base(file.Path), filepath.Base(file.Signature)))80 writer.WriteString(
81 }81 fmt.Sprintf("update %s %s\n", filepath.Base(file.Path), filepath.Base(file.Signature)))
82 writer.WriteString("unmount system\n")82 }
83 writer.WriteString("unmount system\n")
84 }
85
86 //we cannot enable "things" outside of userdata
87 for i := range enable {
88 writer.WriteString(fmt.Sprintf("enable %s\n", enable[i]))
89 }
83 return tmpFile.Name(), err90 return tmpFile.Name(), err
84}91}
8592

Subscribers

People subscribed via source and target branches