Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot/makebootable.go: set snapd_recovery_mode=install at image-build time #9658

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boot/makebootable.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ func makeBootable20(model *asserts.Model, rootdir string, bootWith *BootableSet)
// ubuntu-seed
blVars := map[string]string{
"snapd_recovery_system": bootWith.RecoverySystemLabel,
// always set the mode as install
"snapd_recovery_mode": ModeInstall,
}
if err := bl.SetBootVars(blVars); err != nil {
return fmt.Errorf("cannot set recovery environment: %v", err)
Expand Down
2 changes: 2 additions & 0 deletions boot/makebootable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ version: 5.0
})
c.Check(s.bootloader.BootVars, DeepEquals, map[string]string{
"snapd_recovery_system": label,
"snapd_recovery_mode": "install",
})
}

Expand Down Expand Up @@ -908,6 +909,7 @@ version: 5.0

c.Check(s.bootloader.BootVars, DeepEquals, map[string]string{
"snapd_recovery_system": label,
"snapd_recovery_mode": "install",
})

// ensure the correct recovery system configuration was set
Expand Down
2 changes: 2 additions & 0 deletions image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,7 @@ func (s *imageSuite) TestSetupSeedCore20(c *C) {
})
c.Check(bl.BootVars, DeepEquals, map[string]string{
"snapd_recovery_system": filepath.Base(systems[0]),
"snapd_recovery_mode": "install",
})

// check the downloads
Expand Down Expand Up @@ -2769,6 +2770,7 @@ func (s *imageSuite) TestSetupSeedCore20UBoot(c *C) {
env, err := ubootenv.Open(bootSel)
c.Assert(err, IsNil)
c.Assert(env.Get("snapd_recovery_system"), Equals, expectedLabel)
c.Assert(env.Get("snapd_recovery_mode"), Equals, "install")

// check recovery system specific config
systems, err := filepath.Glob(filepath.Join(seeddir, "systems", "*"))
Expand Down