commit:     9370ca73534408e928474c4a808eb04051e435d3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 31 14:56:48 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Feb 26 10:28:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9370ca73

user.eclass: enewgroup, allow -1 as gid

Allow using '-1' to specify 'next free GID' for enewgroup.  While
technically this can already be specified by omitting gid, allowing -1
improves consistency with enewuser.

Closes: https://bugs.gentoo.org/707508
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/user.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index a33915e2119..b70698356a3 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -252,7 +252,7 @@ enewgroup() {
 
        # handle gid
        local egid=$1; shift
-       if [[ ! -z ${egid} ]] ; then
+       if [[ -n ${egid} && ${egid} != -1 ]] ; then
                if [[ ${egid} -gt 0 ]] ; then
                        if [[ -n $(egetent group ${egid}) ]] ; then
                                [[ -n ${force_gid} ]] && die "${FUNCNAME}: GID 
${egid} already taken"

Reply via email to