[Merge] lp:~jani/goget-ubuntu-touch/recovery-image into lp:goget-ubuntu-touch
Sergio Schvezov
sergio.schvezov at canonical.com
Wed Jan 14 14:50:23 UTC 2015
Review: Needs Fixing
one minor issue, rest looks good and flashed correctly while testing
Diff comments:
> === modified file 'ubuntu-device-flash/touch.go'
> --- ubuntu-device-flash/touch.go 2014-12-03 15:27:51 +0000
> +++ ubuntu-device-flash/touch.go 2015-01-07 10:28:42 +0000
> @@ -42,6 +42,7 @@
> Password string `long:"password" description:"This sets up the default password for the phablet user. This option is meant for CI and not general use"`
> Channel string `long:"channel" description:"Specify the channel to use" default:"ubuntu-touch/stable"`
> Device string `long:"device" description:"Specify the device to flash"`
> + RecoveryImage string `long:"recovery-image" description:"Specify the recovery image file to use when flashing, overriding the one from the device tarball (useful if the latter has no adb enabled)"`
> fastboot devices.Fastboot
> adb devices.UbuntuDebugBridge
> }
> @@ -160,24 +161,34 @@
> }
>
> if touchCmd.Bootstrap {
> - var downloadedFiles []Files
> - for i := 0; i < totalFiles; i++ {
> - downloadedFiles = append(downloadedFiles, <-files)
> - }
> - //Find the recovery image
> - var recovery string
> - for _, file := range downloadedFiles {
> - if strings.HasSuffix(file.FilePath, ".xz") {
> - fmt.Println(file.FilePath)
> - recovery, err = tryExtractRecovery(file.FilePath)
> - if err == nil {
> - break
> + // Unless --recovery-image is passed use the recovery image from the device tarball
> + recovery := touchCmd.RecoveryImage
> +
> + if recovery == "" {
> + var downloadedFiles []Files
> + for i := 0; i < totalFiles; i++ {
> + downloadedFiles = append(downloadedFiles, <-files)
> + }
> + //Find the recovery image
> + for _, file := range downloadedFiles {
> + if strings.HasSuffix(file.FilePath, ".xz") {
> + fmt.Println(file.FilePath)
I would consider this a leftover.
> + recovery, err = tryExtractRecovery(file.FilePath)
> + if err == nil {
> + defer os.Remove(recovery)
> + break
> + }
> }
> }
> - }
> - if recovery == "" {
> - return errors.New("recovery image not found, cannot continue with bootstrap")
> - }
> + if recovery == "" {
> + return errors.New("recovery image not found, cannot continue with bootstrap")
> + }
> + // Resend all the files
> + for _, file := range downloadedFiles {
> + files <- file
> + }
> + }
> +
> if err := touchCmd.fastboot.Flash("recovery", recovery); err != nil {
> return errors.New("can't flash recovery image")
> }
> @@ -189,14 +200,9 @@
> if err := touchCmd.fastboot.BootImage(recovery); err != nil {
> return errors.New("Can't boot recovery image")
> }
> - os.Remove(recovery)
> if err := touchCmd.adb.WaitForRecovery(); err != nil {
> return err
> }
> - // Resend all the files
> - for _, file := range downloadedFiles {
> - files <- file
> - }
> }
> go bitPusher(touchCmd.adb, files, done)
> for i := 0; i < totalFiles; i++ {
>
--
https://code.launchpad.net/~jani/goget-ubuntu-touch/recovery-image/+merge/245724
Your team Ubuntu Phablet Team is subscribed to branch lp:goget-ubuntu-touch.
More information about the Ubuntu-reviews
mailing list