Merge pull request #15948 from wanyaoqi/fix/revert-linux-efi-check

fix(host-deployer): revert linux efi check
This commit is contained in:
Zexi Li
2023-02-15 10:07:39 +08:00
committed by GitHub
+24 -5
View File
@@ -606,13 +606,32 @@ func (l *sLinuxRootFs) dirWalk(part IDiskPartition, sPath string, wF func(path s
}
func (l *sLinuxRootFs) DetectIsUEFISupport(part IDiskPartition) bool {
partDev := part.GetPartDev()
output, err := procutils.NewCommand("efibootmgr", part.GetPartDev()).Output()
if err != nil {
log.Infof("part is not efi partition %s: %s, %s", partDev, output, err)
// ref: https://wiki.archlinux.org/title/EFI_system_partition#Check_for_an_existing_partition
// To confirm this is the ESP, mount it and check whether it contains a directory named EFI,
// if it does this is definitely the ESP.
efiDir := "/EFI"
exits := part.Exists(efiDir, false)
if !exits {
return false
}
return true
hasEFIFirmware := false
l.dirWalk(part, efiDir, func(path string, isDir bool) bool {
if isDir {
return false
}
// check file is UEFI firmware
if strings.HasSuffix(path, ".efi") {
log.Infof("EFI firmware %s found", path)
hasEFIFirmware = true
return true
}
// continue walk
return false
})
return hasEFIFirmware
}
func (l *sLinuxRootFs) IsCloudinitInstall() bool {