mirror of
https://github.com/kairos-io/kcrypt.git
synced 2025-09-12 21:29:24 +00:00
Add label to luks partition and dont gate on label (#471)
* Add label to luks partition and dont gate on label Instead of gating on labels, lets just add the label to the luks partition, the same way we do to the underlying unlocked partition, so they share the fs label. That way, the locking and unlocking refer to the same label always --------- Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/jaypipes/ghw/pkg/block"
|
||||
"github.com/kairos-io/kairos-sdk/collector"
|
||||
"github.com/pkg/errors"
|
||||
@@ -121,25 +120,3 @@ func (c Config) LookupLabelForUUID(uuid string) string {
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetLabelForUUID returns the partition label for a known UUID
|
||||
// UUIDS are generated on luksify method
|
||||
// They are generated by setting the namespace to DNS and the name to the fs label, so they are always the same
|
||||
func (c Config) GetLabelForUUID(uuidCheck string) (string, error) {
|
||||
persistent := uuid.NewV5(uuid.NamespaceURL, "COS_PERSISTENT")
|
||||
oem := uuid.NewV5(uuid.NamespaceURL, "COS_OEM")
|
||||
fmt.Printf("Checking uuid: %s\n", uuidCheck)
|
||||
parsedUUID, err := uuid.FromString(uuidCheck)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
switch parsedUUID {
|
||||
case persistent:
|
||||
return "COS_PERSISTENT", nil
|
||||
case oem:
|
||||
return "COS_OEM", nil
|
||||
default:
|
||||
return "", errors.New("no partition found with that uuid")
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user