diff -Nru goget-ubuntu-touch-0.2+14.04.20140224/debian/changelog goget-ubuntu-touch-0.2+14.04.20140227.1/debian/changelog --- goget-ubuntu-touch-0.2+14.04.20140224/debian/changelog 2014-02-27 16:10:19.000000000 +0000 +++ goget-ubuntu-touch-0.2+14.04.20140227.1/debian/changelog 2014-02-27 16:10:19.000000000 +0000 @@ -1,3 +1,13 @@ +goget-ubuntu-touch (0.2+14.04.20140227.1-0ubuntu1) trusty; urgency=low + + [ Sergio Schvezov ] + * Switching ubuntu-device-flash from the default flag package to + "github.com/jessevdk/go-flags" which is also used for ubuntu- + emulator. This would enable the hidden cdimage download in a future + code change. + + -- Ubuntu daily release Thu, 27 Feb 2014 15:26:18 +0000 + goget-ubuntu-touch (0.2+14.04.20140224-0ubuntu1) trusty; urgency=low [ Sergio Schvezov ] diff -Nru goget-ubuntu-touch-0.2+14.04.20140224/ubuntu-device-flash/args.go goget-ubuntu-touch-0.2+14.04.20140227.1/ubuntu-device-flash/args.go --- goget-ubuntu-touch-0.2+14.04.20140224/ubuntu-device-flash/args.go 2014-02-24 16:11:26.000000000 +0000 +++ goget-ubuntu-touch-0.2+14.04.20140227.1/ubuntu-device-flash/args.go 2014-02-27 15:26:11.000000000 +0000 @@ -21,31 +21,29 @@ // with this program. If not, see . import ( - "flag" - "log" + flags "github.com/jessevdk/go-flags" ) type arguments struct { - revision *int - bootstrap, listChannels, wipe *bool - channel, device, serial, server *string + Revision int `long:"revision" description:"revision to flash, absolute or relative allowed"` + Bootstrap bool `long:"bootstrap" description:"bootstrap the system, do this from the bootloader"` + ListChannels bool `long:"list-channels" description:"List available channels"` + Wipe bool `long:"wipe" description:"Clear all data after flashing"` + Channel string `long:"channel" description:"Specify an alternate channel"` + Device string `long:"device" description:"Specify the device to flash"` + Serial string `long:"serial" description:"Serial of the device to operate"` + Server string `long:"server" description:"Use a different image server"` } var args arguments +var parser = flags.NewParser(&args, flags.Default) + +const ( + defaultChannel = "stable" + defaultServer = "https://system-image.ubuntu.com" +) func init() { - args.bootstrap = flag.Bool("bootstrap", false, "Bootstrap the system, do this from fastboot") - args.wipe = flag.Bool("wipe", false, "Clear all data after flashing") - args.revision = flag.Int("revision", 0, "Revision to flash, 0 is current, "+ - "use explicit version number or negative relative ones to current") - args.channel = flag.String("channel", "stable", "Select channel to flash") - args.device = flag.String("device", "", "Select device to flash") - args.serial = flag.String("serial", "", "Serial of the device to operate") - args.server = flag.String("server", "https://system-image.ubuntu.com", - "Select image server") - args.listChannels = flag.Bool("list-channels", false, "List available channels") - flag.Parse() - if *args.bootstrap && *args.wipe { - log.Fatal("Cannot bootstrap and wipe at the same time") - } + args.Channel = defaultChannel + args.Server = defaultServer } diff -Nru goget-ubuntu-touch-0.2+14.04.20140224/ubuntu-device-flash/main.go goget-ubuntu-touch-0.2+14.04.20140227.1/ubuntu-device-flash/main.go --- goget-ubuntu-touch-0.2+14.04.20140224/ubuntu-device-flash/main.go 2014-02-24 16:11:45.000000000 +0000 +++ goget-ubuntu-touch-0.2+14.04.20140227.1/ubuntu-device-flash/main.go 2014-02-27 15:26:11.000000000 +0000 @@ -36,36 +36,39 @@ ) func main() { + if _, err := parser.Parse(); err != nil { + os.Exit(1) + } cacheDir := ubuntuimage.GetCacheDir() adb, err := devices.NewUbuntuDebugBridge() var fastboot devices.Fastboot if err != nil { log.Fatal(err) } - if *args.serial != "" { - adb.SetSerial(*args.serial) - fastboot.SetSerial(*args.serial) + if args.Serial != "" { + adb.SetSerial(args.Serial) + fastboot.SetSerial(args.Serial) } - if *args.device == "" { - if *args.bootstrap { + if args.Device == "" { + if args.Bootstrap { log.Print("Expecting the device to be in the bootloader... waiting") - *args.device, err = fastboot.GetDevice() + args.Device, err = fastboot.GetDevice() } else { log.Print("Expecting the device to expose an adb interface...") // TODO needs to work from recovery as well //adb.WaitForDevice() - *args.device, err = adb.GetDevice() + args.Device, err = adb.GetDevice() } if err != nil { log.Fatal(err) } } - log.Printf("Device is |%s|", *args.device) - channels, err := ubuntuimage.NewChannels(*args.server) + log.Printf("Device is |%s|", args.Device) + channels, err := ubuntuimage.NewChannels(args.Server) if err != nil { log.Fatal(err) } - if *args.listChannels { + if args.ListChannels { for k, v := range channels { if v.Alias != "" { fmt.Printf("%s (alias to %s)\n", k, v.Alias) @@ -76,23 +79,23 @@ return } deviceChannel, err := channels.GetDeviceChannel( - *args.server, *args.channel, *args.device) + args.Server, args.Channel, args.Device) if err != nil { log.Fatal(err) } var image ubuntuimage.Image - if *args.revision == 0 { + if args.Revision == 0 { image, err = deviceChannel.GetLatestImage() } else { - image, err = deviceChannel.GetImage(*args.revision) + image, err = deviceChannel.GetImage(args.Revision) } if err != nil { log.Fatal(err) } log.Printf("Flashing version %d from %s channel and server %s to device %s", - image.Version, *args.channel, *args.server, *args.device) + image.Version, args.Channel, args.Server, args.Device) if deviceChannel.Alias != "" { - log.Printf("%s is a channel alias to %s", deviceChannel.Alias, *args.channel) + log.Printf("%s is a channel alias to %s", deviceChannel.Alias, args.Channel) } // TODO use closures @@ -101,12 +104,12 @@ files := make(chan Files, totalFiles) done := make(chan bool, totalFiles) for _, file := range image.Files { - go bitDownloader(file, files, *args.server, cacheDir) + go bitDownloader(file, files, args.Server, cacheDir) } for _, file := range signFiles { - go bitDownloader(file, files, *args.server, cacheDir) + go bitDownloader(file, files, args.Server, cacheDir) } - if *args.bootstrap { + if args.Bootstrap { var downloadedFiles []Files for i := 0; i < totalFiles; i++ { downloadedFiles = append(downloadedFiles, <-files) @@ -144,13 +147,13 @@ for _, file := range downloadedFiles { files <- file } - *args.wipe = true + args.Wipe = true } go bitPusher(adb, files, done) for i := 0; i < totalFiles; i++ { <-done } - ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(image.Files, cacheDir, *args.wipe) + ubuntuCommands, err := ubuntuimage.GetUbuntuCommands(image.Files, cacheDir, args.Wipe) if err != nil { log.Fatal("Cannot create commands file") } @@ -269,3 +272,4 @@ return rpipe } +