Skip to content

Commit 79f2420

Browse files
committed
incusd/instance/qemu: Skip to link nvram to itself
Signed-off-by: JUN JIE NAN <[email protected]>
1 parent 2505c88 commit 79f2420

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/server/instance/drivers/driver_qemu.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -2215,11 +2215,16 @@ func (d *qemu) setupNvram() error {
22152215
return err
22162216
}
22172217

2218+
nvramPath := d.nvramPath()
2219+
if efiVarsName == filepath.Base(nvramPath) { // Skip to link qemu.nvram to itself
2220+
return nil
2221+
}
2222+
22182223
// Generate a symlink.
22192224
// This is so qemu.nvram can always be assumed to be the EDK2 vars file.
22202225
// The real file name is then used to determine what firmware must be selected.
2221-
_ = os.Remove(d.nvramPath())
2222-
err = os.Symlink(efiVarsName, d.nvramPath())
2226+
_ = os.Remove(nvramPath)
2227+
err = os.Symlink(efiVarsName, nvramPath)
22232228
if err != nil {
22242229
return err
22252230
}

0 commit comments

Comments
 (0)