MCPcopy Create free account
hub / github.com/celer-pkg/celer / changeGroupGID

Function changeGroupGID

pkgcache/cache_setup.go:510–521  ·  view source on GitHub ↗
(groupName, oldGID, requiredGID string)

Source from the content-addressed store, hash-verified

508}
509
510func changeGroupGID(groupName, oldGID, requiredGID string) error {
511 if err := ensureGroupIDUnused(requiredGID, groupName); err != nil {
512 return err
513 }
514
515 if output, err := cmd.NewExecutor("", "groupmod", "-g", requiredGID, groupName).ExecuteOutput(); err != nil {
516 return fmt.Errorf("failed to change %s group gid from %s to %s -> %s -> %w", groupName, oldGID, requiredGID, output, err)
517 }
518
519 color.PrintHint("✔ change system group %s gid from %s to %s", groupName, oldGID, requiredGID)
520 return nil
521}
522
523func removeSystemGroupAndUser(username string) error {
524 // If the user is still in the group, groupdel may fail or leave the system in an inconsistent state.

Callers 1

createSystemGroupAndUserFunction · 0.85

Calls 4

NewExecutorFunction · 0.92
PrintHintFunction · 0.92
ensureGroupIDUnusedFunction · 0.85
ExecuteOutputMethod · 0.80

Tested by

no test coverage detected