1
0
mirror of https://github.com/kairos-io/kairos-agent.git synced 2025-05-12 10:24:23 +00:00

Do not show devices that cant be used ()

during interactive install all devices will appear but some of those are
not desirable as they cannot be used to install.

Skip those in the list

Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
Itxaka 2024-01-26 15:09:13 +01:00 committed by GitHub
parent 5014587a3c
commit 8696eb16d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -149,6 +149,10 @@ func InteractiveInstall(debug, spawnShell bool, sourceImgURL string) error {
block, err := ghw.Block()
if err == nil {
for _, disk := range block.Disks {
// skip useless devices (/dev/ram, /dev/loop, /dev/sr, /dev/zram)
if strings.HasPrefix(disk.Name, "loop") || strings.HasPrefix(disk.Name, "ram") || strings.HasPrefix(disk.Name, "sr") || strings.HasPrefix(disk.Name, "zram") {
continue
}
size := float64(disk.SizeBytes) / float64(GiB)
if size > maxSize {
maxSize = size