mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(host-deployer): revert linux efi check
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user