mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-09-24 04:18:13 +00:00
Bump ghw and fix state (#1073)
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
@@ -16,14 +16,14 @@ func PrepareWrite(partition state.PartitionState, mountpath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return machine.Mount(partition.Label, mountpath)
|
||||
return machine.Mount(partition.FilesystemLabel, mountpath)
|
||||
}
|
||||
|
||||
return machine.Mount(partition.Label, mountpath)
|
||||
return machine.Mount(partition.FilesystemLabel, mountpath)
|
||||
}
|
||||
|
||||
func Mount(partition state.PartitionState, mountpath string) error {
|
||||
return machine.Mount(partition.Label, mountpath)
|
||||
return machine.Mount(partition.FilesystemLabel, mountpath)
|
||||
}
|
||||
|
||||
func Umount(partition state.PartitionState) error {
|
||||
|
@@ -30,6 +30,7 @@ type PartitionState struct {
|
||||
Mounted bool `yaml:"mounted" json:"mounted"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Label string `yaml:"label" json:"label"`
|
||||
FilesystemLabel string `yaml:"filesystemlabel" json:"filesystemlabel"`
|
||||
MountPoint string `yaml:"mount_point" json:"mount_point"`
|
||||
SizeBytes uint64 `yaml:"size_bytes" json:"size_bytes"`
|
||||
Type string `yaml:"type" json:"type"`
|
||||
@@ -66,8 +67,8 @@ func detectPartition(b *block.Partition) PartitionState {
|
||||
// This is a current shortcoming of ghw which only identifies mountpoints via device, not by label/uuid/anything else
|
||||
mountpoint := b.MountPoint
|
||||
readOnly := b.IsReadOnly
|
||||
if b.MountPoint == "" && b.Label != "" {
|
||||
out, err := utils.SH(fmt.Sprintf("findmnt /dev/disk/by-label/%s -f -J -o TARGET,FS-OPTIONS", b.Label))
|
||||
if b.MountPoint == "" && b.FilesystemLabel != "" {
|
||||
out, err := utils.SH(fmt.Sprintf("findmnt /dev/disk/by-label/%s -f -J -o TARGET,FS-OPTIONS", b.FilesystemLabel))
|
||||
fmt.Println(out)
|
||||
mnt := &FndMnt{}
|
||||
if err == nil {
|
||||
@@ -94,6 +95,7 @@ func detectPartition(b *block.Partition) PartitionState {
|
||||
Name: fmt.Sprintf("/dev/%s", b.Name),
|
||||
SizeBytes: b.SizeBytes,
|
||||
Label: b.Label,
|
||||
FilesystemLabel: b.FilesystemLabel,
|
||||
MountPoint: mountpoint,
|
||||
Mounted: mountpoint != "",
|
||||
Found: true,
|
||||
@@ -129,7 +131,7 @@ func detectRuntimeState(r *Runtime) error {
|
||||
}
|
||||
for _, d := range blockDevices.Disks {
|
||||
for _, part := range d.Partitions {
|
||||
switch part.Label {
|
||||
switch part.FilesystemLabel {
|
||||
case "COS_PERSISTENT":
|
||||
r.Persistent = detectPartition(part)
|
||||
case "COS_RECOVERY":
|
||||
|
Reference in New Issue
Block a user