mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-24 05:41:43 +02:00
Added explicit detection of disk or part block type, ignoring non-suppoorted devices
This commit is contained in:
@@ -88,9 +88,15 @@ func GetDevices() []Device {
|
|||||||
deviceRawInfo := strings.Fields(scanner.Text())
|
deviceRawInfo := strings.Fields(scanner.Text())
|
||||||
majMin := strings.SplitN(deviceRawInfo[1], ":", 2)
|
majMin := strings.SplitN(deviceRawInfo[1], ":", 2)
|
||||||
|
|
||||||
isDevice := true
|
isDevice := false
|
||||||
|
isPartition := false
|
||||||
if deviceRawInfo[5] == "part" {
|
if deviceRawInfo[5] == "part" {
|
||||||
isDevice = false
|
isDevice = false
|
||||||
|
isPartition = true
|
||||||
|
|
||||||
|
} else if deviceRawInfo[5] == "disk" {
|
||||||
|
isDevice = true
|
||||||
|
isPartition = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if isDevice {
|
if isDevice {
|
||||||
@@ -133,7 +139,7 @@ func GetDevices() []Device {
|
|||||||
|
|
||||||
currentDevice = device
|
currentDevice = device
|
||||||
|
|
||||||
} else {
|
} else if isPartition {
|
||||||
|
|
||||||
mountpoint := ""
|
mountpoint := ""
|
||||||
if len(deviceRawInfo) >= 7 {
|
if len(deviceRawInfo) >= 7 {
|
||||||
@@ -155,6 +161,8 @@ func GetDevices() []Device {
|
|||||||
|
|
||||||
currentPartitions = append(currentPartitions, partition)
|
currentPartitions = append(currentPartitions, partition)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fmt.Println("Found device not compatible with Edgebox, ignoring.")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user