(groupName, oldGID, requiredGID string)
| 508 | } |
| 509 | |
| 510 | func 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 | |
| 523 | func removeSystemGroupAndUser(username string) error { |
| 524 | // If the user is still in the group, groupdel may fail or leave the system in an inconsistent state. |
no test coverage detected