diff options
author | Milan Bouchet-Valat <nalimilan@club.fr> | 2010-12-16 15:32:50 +0100 |
---|---|---|
committer | Milan Bouchet-Valat <nalimilan@club.fr> | 2010-12-16 15:35:39 +0100 |
commit | bd1beddc1c07fe1a3a924356313971654eea93cc (patch) | |
tree | 95b3a4c0599625a8f6bb4602048f4df3903f42d1 | |
parent | 89eb4014d1196eda59ba9a406a6a50cc23bce465 (diff) |
Allow creating groups without fixed GID
If 0xFFFFFFFF is passed as GID when creating a group, let the
platform tools choose the value. This is what we currently do for
users.
-rw-r--r-- | Users/Groups.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Users/Groups.pm b/Users/Groups.pm index ba674e1..58ccef3 100644 --- a/Users/Groups.pm +++ b/Users/Groups.pm @@ -137,25 +137,32 @@ sub add_group $u = $$group[$USERS]; + # max value means default UID or GID here + $real_gid = ($$group[$GID] != 0xFFFFFFFF); + if ($Utils::Backend::tool{"system"} eq "FreeBSD") { @users = sort @$u; - + + @command = ($cmd_pw, "groupadd", "-n", $$group[$LOGIN], - "-g", $$group[$GID], "-M", @users); + push (@command, ("-g", $$group[$GID])) if $real_gid; + &Utils::File::run (@command); } else { if ($cmd_addgroup) { - @command = ($cmd_addgroup, "--gid", $$group[$GID], $$group[$LOGIN]); + @command = ($cmd_addgroup, $$group[$LOGIN]); + push (@command, ("--gid", $$group[$GID])) if $real_gid; } else { - @command = ($cmd_groupadd, "-g", $$group[$GID], $$group[$LOGIN]); + @command = ($cmd_groupadd, $$group[$LOGIN]); + push (@command, ("-g", $$group[$GID])) if $real_gid; } &Utils::File::run (@command); |