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
1=== modified file 'diskimage/core_grub.go'
2--- diskimage/core_grub.go 2015-06-23 13:09:28 +0000
3+++ diskimage/core_grub.go 2015-09-15 16:14:18 +0000
4@@ -14,7 +14,6 @@
5 "os"
6 "os/exec"
7 "path/filepath"
8- "time"
9
10 "launchpad.net/goget-ubuntu-touch/sysutils"
11 )
12@@ -33,11 +32,9 @@
13
14 type CoreGrubImage struct {
15 BaseImage
16-
17- legacyGrub bool
18 }
19
20-func NewCoreGrubImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription, updateGrub bool) *CoreGrubImage {
21+func NewCoreGrubImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription) *CoreGrubImage {
22 return &CoreGrubImage{
23 BaseImage: BaseImage{
24 location: location,
25@@ -47,7 +44,6 @@
26 oem: oem,
27 partCount: 5,
28 },
29- legacyGrub: updateGrub,
30 }
31 }
32
33@@ -88,12 +84,10 @@
34 }
35
36 func (img *CoreGrubImage) SetupBoot() error {
37- if !img.legacyGrub {
38- // destinations
39- bootPath := filepath.Join(img.baseMount, string(bootDir), "EFI", "ubuntu", "grub")
40- if err := img.GenericBootSetup(bootPath); err != nil {
41- return err
42- }
43+ // destinations
44+ bootPath := filepath.Join(img.baseMount, string(bootDir), "EFI", "ubuntu", "grub")
45+ if err := img.GenericBootSetup(bootPath); err != nil {
46+ return err
47 }
48
49 return img.setupGrub()
50@@ -193,37 +187,6 @@
51 return err
52 }
53
54- if img.legacyGrub {
55- if err := img.updateGrub(); err != nil {
56- return err
57- }
58- }
59-
60- return nil
61-}
62-
63-func (img *CoreGrubImage) updateGrub() error {
64- // ensure we run not into recordfail issue
65- grubDir := filepath.Join(img.System(), "etc", "default", "grub.d")
66- if err := os.MkdirAll(grubDir, 0755); err != nil {
67- return fmt.Errorf("unable to create %s dir: %s", grubDir, err)
68- }
69- grubFile, err := os.Create(filepath.Join(grubDir, "50-system-image.cfg"))
70- if err != nil {
71- return fmt.Errorf("unable to create %s file: %s", grubFile.Name(), err)
72- }
73- defer grubFile.Close()
74- if _, err := io.WriteString(grubFile, grubCfgContent); err != nil {
75- return err
76- }
77-
78- // I don't know why this is needed, I just picked it up from the original implementation
79- time.Sleep(3 * time.Second)
80-
81- if out, err := exec.Command("chroot", img.System(), "update-grub").CombinedOutput(); err != nil {
82- return fmt.Errorf("unable to update grub: %s", out)
83- }
84-
85 return nil
86 }
87
88
89=== modified file 'ubuntu-device-flash/snappy.go'
90--- ubuntu-device-flash/snappy.go 2015-09-08 14:59:54 +0000
91+++ ubuntu-device-flash/snappy.go 2015-09-15 16:14:18 +0000
92@@ -517,8 +517,7 @@
93 loader := s.oem.OEM.Hardware.Bootloader
94 switch loader {
95 case "grub":
96- legacyGrub := s.Positional.Release == "15.04"
97- s.img = diskimage.NewCoreGrubImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem, legacyGrub)
98+ s.img = diskimage.NewCoreGrubImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem)
99 case "u-boot":
100 s.img = diskimage.NewCoreUBootImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem)
101 default:

Subscribers

People subscribed via source and target branches