summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2022-06-24 12:04:29 -0400
committerMike Gilbert <floppym@gentoo.org>2022-06-27 14:59:46 -0400
commit1aad461ffd13f98f6d736823b1e6678ed0503757 (patch)
treefb6ca10b701181ae2bef0c9c19816dd2cce874d5 /eclass
parentnet-libs/libtirpc: update LICENSE (diff)
downloadgentoo-1aad461ffd13f98f6d736823b1e6678ed0503757.tar.gz
gentoo-1aad461ffd13f98f6d736823b1e6678ed0503757.tar.bz2
gentoo-1aad461ffd13f98f6d736823b1e6678ed0503757.zip
user.eclass: allow UID/GID 0 in enewuser/enewgroup
Used by acct-{user,group}/root. The check is skipped on most systems because root is created by baselayout. An error may be produced if a user runs emerge --root=/myroot acct-user/root, where /myroot is an empty directory. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/user.eclass8
1 files changed, 4 insertions, 4 deletions
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 906e84e83c69..d5b827d2e76b 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -123,13 +123,13 @@ enewuser() {
# handle uid
local euid=${1}; shift
if [[ -n ${euid} && ${euid} != -1 ]] ; then
- if [[ ${euid} -gt 0 ]] ; then
+ if [[ ${euid} -ge 0 ]] ; then
if [[ -n $(egetent passwd ${euid}) ]] ; then
[[ -n ${force_uid} ]] && die "${FUNCNAME}: UID ${euid} already taken"
euid="next"
fi
else
- eerror "Userid given but is not greater than 0!"
+ eerror "Userid given but is not greater than or equal to 0!"
die "${euid} is not a valid UID"
fi
else
@@ -289,13 +289,13 @@ enewgroup() {
# handle gid
local egid=${1}; shift
if [[ -n ${egid} && ${egid} != -1 ]] ; then
- if [[ ${egid} -gt 0 ]] ; then
+ if [[ ${egid} -ge 0 ]] ; then
if [[ -n $(egetent group ${egid}) ]] ; then
[[ -n ${force_gid} ]] && die "${FUNCNAME}: GID ${egid} already taken"
egid="next available; requested gid taken"
fi
else
- eerror "Groupid given but is not greater than 0!"
+ eerror "Groupid given but is not greater than or equal to 0!"
die "${egid} is not a valid GID"
fi
else