Skip to content

Commit

Permalink
Do not overwrite ovmf vars if they exist
Browse files Browse the repository at this point in the history
The VM may have made ovmf vars changes.  We do not want to clobber
those.

Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
hallyn committed Oct 23, 2023
1 parent 65a2543 commit d6156ca
Showing 1 changed file with 6 additions and 7 deletions.
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

0 comments on commit d6156ca

Please sign in to comment.