Merge lp:~sergiusens/goget-ubuntu-touch/legacy-grub-- into lp:goget-ubuntu-touch

Proposed by Sergio Schvezov
Status: Merged
Approved by: Ricardo Mendoza
Approved revision: 210
Merged at revision: 210
Proposed branch: lp:~sergiusens/goget-ubuntu-touch/legacy-grub--
Merge into: lp:goget-ubuntu-touch
Diff against target: 101 lines (+6/-44)
2 files modified
diskimage/core_grub.go (+5/-42)
ubuntu-device-flash/snappy.go (+1/-2)
To merge this branch: bzr merge lp:~sergiusens/goget-ubuntu-touch/legacy-grub--
Reviewer Review Type Date Requested Status
Ricardo Mendoza (community) Approve
Review via email: mp+271150@code.launchpad.net

Commit message

Remove legacy grub handling (running of update-grub)

To post a comment you must log in.
Revision history for this message
Ricardo Mendoza (ricmm) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'diskimage/core_grub.go'
--- diskimage/core_grub.go 2015-06-23 13:09:28 +0000
+++ diskimage/core_grub.go 2015-09-15 16:14:18 +0000
@@ -14,7 +14,6 @@
14 "os"14 "os"
15 "os/exec"15 "os/exec"
16 "path/filepath"16 "path/filepath"
17 "time"
1817
19 "launchpad.net/goget-ubuntu-touch/sysutils"18 "launchpad.net/goget-ubuntu-touch/sysutils"
20)19)
@@ -33,11 +32,9 @@
3332
34type CoreGrubImage struct {33type CoreGrubImage struct {
35 BaseImage34 BaseImage
36
37 legacyGrub bool
38}35}
3936
40func NewCoreGrubImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription, updateGrub bool) *CoreGrubImage {37func NewCoreGrubImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription) *CoreGrubImage {
41 return &CoreGrubImage{38 return &CoreGrubImage{
42 BaseImage: BaseImage{39 BaseImage: BaseImage{
43 location: location,40 location: location,
@@ -47,7 +44,6 @@
47 oem: oem,44 oem: oem,
48 partCount: 5,45 partCount: 5,
49 },46 },
50 legacyGrub: updateGrub,
51 }47 }
52}48}
5349
@@ -88,12 +84,10 @@
88}84}
8985
90func (img *CoreGrubImage) SetupBoot() error {86func (img *CoreGrubImage) SetupBoot() error {
91 if !img.legacyGrub {87 // destinations
92 // destinations88 bootPath := filepath.Join(img.baseMount, string(bootDir), "EFI", "ubuntu", "grub")
93 bootPath := filepath.Join(img.baseMount, string(bootDir), "EFI", "ubuntu", "grub")89 if err := img.GenericBootSetup(bootPath); err != nil {
94 if err := img.GenericBootSetup(bootPath); err != nil {90 return err
95 return err
96 }
97 }91 }
9892
99 return img.setupGrub()93 return img.setupGrub()
@@ -193,37 +187,6 @@
193 return err187 return err
194 }188 }
195189
196 if img.legacyGrub {
197 if err := img.updateGrub(); err != nil {
198 return err
199 }
200 }
201
202 return nil
203}
204
205func (img *CoreGrubImage) updateGrub() error {
206 // ensure we run not into recordfail issue
207 grubDir := filepath.Join(img.System(), "etc", "default", "grub.d")
208 if err := os.MkdirAll(grubDir, 0755); err != nil {
209 return fmt.Errorf("unable to create %s dir: %s", grubDir, err)
210 }
211 grubFile, err := os.Create(filepath.Join(grubDir, "50-system-image.cfg"))
212 if err != nil {
213 return fmt.Errorf("unable to create %s file: %s", grubFile.Name(), err)
214 }
215 defer grubFile.Close()
216 if _, err := io.WriteString(grubFile, grubCfgContent); err != nil {
217 return err
218 }
219
220 // I don't know why this is needed, I just picked it up from the original implementation
221 time.Sleep(3 * time.Second)
222
223 if out, err := exec.Command("chroot", img.System(), "update-grub").CombinedOutput(); err != nil {
224 return fmt.Errorf("unable to update grub: %s", out)
225 }
226
227 return nil190 return nil
228}191}
229192
230193
=== modified file 'ubuntu-device-flash/snappy.go'
--- ubuntu-device-flash/snappy.go 2015-09-08 14:59:54 +0000
+++ ubuntu-device-flash/snappy.go 2015-09-15 16:14:18 +0000
@@ -517,8 +517,7 @@
517 loader := s.oem.OEM.Hardware.Bootloader517 loader := s.oem.OEM.Hardware.Bootloader
518 switch loader {518 switch loader {
519 case "grub":519 case "grub":
520 legacyGrub := s.Positional.Release == "15.04"520 s.img = diskimage.NewCoreGrubImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem)
521 s.img = diskimage.NewCoreGrubImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem, legacyGrub)
522 case "u-boot":521 case "u-boot":
523 s.img = diskimage.NewCoreUBootImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem)522 s.img = diskimage.NewCoreUBootImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem)
524 default:523 default:

Subscribers

People subscribed via source and target branches