mirror of
https://github.com/Mic92/sops-nix.git
synced 2026-07-17 14:35:25 +08:00
darwin: workaround missing user
This commit is contained in:
parent
e6ccc740d8
commit
58ceff1f7b
1 changed files with 14 additions and 2 deletions
|
|
@ -368,8 +368,8 @@ func writeSecrets(secretDir string, secrets []secret, keysGid int, userMode bool
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func lookupKeysGroup() (int, error) {
|
func lookupGroup(groupname string) (int, error) {
|
||||||
group, err := user.LookupGroup("keys")
|
group, err := user.LookupGroup(groupname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("Failed to lookup 'keys' group: %w", err)
|
return 0, fmt.Errorf("Failed to lookup 'keys' group: %w", err)
|
||||||
}
|
}
|
||||||
|
|
@ -380,6 +380,18 @@ func lookupKeysGroup() (int, error) {
|
||||||
return int(gid), nil
|
return int(gid), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func lookupKeysGroup() (int, error) {
|
||||||
|
gid, err1 := lookupGroup("keys")
|
||||||
|
if err1 == nil {
|
||||||
|
return gid, nil
|
||||||
|
}
|
||||||
|
gid, err2 := lookupGroup("nogroup")
|
||||||
|
if err2 == nil {
|
||||||
|
return gid, nil
|
||||||
|
}
|
||||||
|
return 0, fmt.Errorf("Can't find group 'keys' nor 'nogroup' (%w).", err2)
|
||||||
|
}
|
||||||
|
|
||||||
func (app *appContext) loadSopsFile(s *secret) (*secretFile, error) {
|
func (app *appContext) loadSopsFile(s *secret) (*secretFile, error) {
|
||||||
if app.checkMode == Manifest {
|
if app.checkMode == Manifest {
|
||||||
return &secretFile{firstSecret: s}, nil
|
return &secretFile{firstSecret: s}, nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue