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
snap-preseed: support for preseeding of snapd and core18 #8170
Changes from all commits
52efdf5
55d6b49
f929a5c
f08151e
5a80a15
6ce59ae
cafdaa5
6a42565
140ca44
9be5e62
f8c9003
9402af6
be27139
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,24 +85,37 @@ var systemSnapFromSeed = func(rootDir string) (string, error) { | |
return "", err | ||
} | ||
|
||
// TODO: handle core18, snapd snap. | ||
model, err := seed.Model() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
// TODO: implement preseeding for core. | ||
if !model.Classic() { | ||
return "", fmt.Errorf("preseeding is only supported on classic systems") | ||
} | ||
|
||
var required string | ||
if seed.UsesSnapdSnap() { | ||
return "", fmt.Errorf("preseeding with snapd snap is not supported yet") | ||
required = "snapd" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably still fail here if the model is not classic ? that needs its own tests and need to deal with wrappers/core18.go, no ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm you're right, and I missed wrappers for core18, definately needs a close look, probably needs extra checks in the spread test too. Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be clear the code in wrappers/core18.go is a nop for classic afair There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, it's a noop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Added error on non-classic + test. |
||
} else { | ||
required = "core" | ||
} | ||
|
||
var coreSnapPath string | ||
var snapPath string | ||
ess := seed.EssentialSnaps() | ||
if len(ess) > 0 { | ||
if ess[0].SnapName() == "core" { | ||
coreSnapPath = ess[0].Path | ||
// core / snapd snap is the first essential snap. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
if ess[0].SnapName() == required { | ||
snapPath = ess[0].Path | ||
} | ||
} | ||
|
||
if coreSnapPath == "" { | ||
return "", fmt.Errorf("core snap not found") | ||
if snapPath == "" { | ||
return "", fmt.Errorf("%s snap not found", required) | ||
} | ||
|
||
return coreSnapPath, nil | ||
return snapPath, nil | ||
} | ||
|
||
const snapdPreseedSupportVer = `2.43.3+` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
snaps: | ||
- name: snapd | ||
file: @SNAPD@ | ||
unasserted: true | ||
- name: core18 | ||
file: @CORE@ | ||
unasserted: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably leave a TODO note to enable this on core as well.