Add functions to produce a string representation of a partition

so that we encapsulate all the logic in the same package

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
Dimitris Karakasilis
2022-11-11 12:11:43 +02:00
parent c0d6b81b5d
commit 8ca95e953b
3 changed files with 52 additions and 3 deletions

View File

@@ -17,6 +17,8 @@ import (
"github.com/mudler/go-pluggable"
cp "github.com/otiai10/copy"
"github.com/urfave/cli"
pi "github.com/kairos-io/kcrypt/pkg/partition_info"
)
func waitdevice(device string, attempts int) error {
@@ -152,7 +154,7 @@ func luksify(label string) (string, error) {
return "", fmt.Errorf("err: %w, out: %s", err, out2)
}
return fmt.Sprintf("%s:%s:%s", b.Label, b.Name, b.UUID), nil
return pi.PartitionToString(b), nil
}
func findPartition(label string) (string, *block.Partition, error) {