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

Do not overwrite ovmf vars if they exist #29

Merged
merged 1 commit into from
Oct 23, 2023
Merged
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
13 changes: 6 additions & 7 deletions pkg/api/qconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,12 @@ func ConfigureUEFIVars(c *qcli.Config, srcCode, srcVars, runDir string, secureBo
}
dest = filepath.Join(runDir, qcli.UEFIVarsFileName)
log.Infof("Importing UEFI Vars from '%s' to '%q'", src, dest)
// FIXME: should we skip re-import of srcVars, the imported Vars may have
// had changes that a new import would clobber, warning for now
if PathExists(dest) {
log.Warnf("Already imported UEFI Vars file %q to %q, overwriting...", src, dest)
}
if err := CopyFileBits(src, dest); err != nil {
return fmt.Errorf("Failed to import UEFI Vars from '%s' to '%q': %s", src, dest, err)
if !PathExists(dest) {
if err := CopyFileBits(src, dest); err != nil {
return fmt.Errorf("Failed to import UEFI Vars from '%s' to '%q': %s", src, dest, err)
}
} else {
log.Infof("Already imported UEFI Vars file %q to %q. Not overwriting.", src, dest)
}
uefiDev.Vars = dest

Expand Down