fix(host): check file exist before copy ovmf vars (#24367)

This commit is contained in:
wanyaoqi
2026-03-11 19:29:50 +08:00
committed by GitHub
parent 6dbc39b04f
commit bf838b80c0

View File

@@ -297,7 +297,7 @@ func (o baseOptions) BIOS(ovmfPath, ovmfVarsPath, homedir string) (string, error
guestOvmfVarsPath := path.Join(homedir, ovmfVarsName)
if !fileutils2.Exists(guestOvmfVarsPath) {
sourceOvmfVarsPath := ovmfPath
if ovmfVarsPath != "" {
if ovmfVarsPath != "" && fileutils2.Exists(ovmfVarsPath) {
sourceOvmfVarsPath = ovmfVarsPath
}
err := procutils.NewRemoteCommandAsFarAsPossible("cp", "-f", sourceOvmfVarsPath, guestOvmfVarsPath).Run()