summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-08-07 19:07:45 +0200
committerMichał Górny <mgorny@gentoo.org>2019-08-17 22:36:31 +0200
commitc871b87b56208684b0a1fedeaf24fe10943748e2 (patch)
tree53ec8282153965ff28c298ec22dff6abcfd64f2a /eclass/acct-group.eclass
parentnet-fs/autofs: stable 5.1.5-r2 for ppc, bug #692028 (diff)
downloadgentoo-c871b87b56208684b0a1fedeaf24fe10943748e2.tar.gz
gentoo-c871b87b56208684b0a1fedeaf24fe10943748e2.tar.bz2
gentoo-c871b87b56208684b0a1fedeaf24fe10943748e2.zip
acct-*.eclass: Allow dynamic UID/GID assignment via -1
Allow a special value of '-1' to dynamically assign UID/GID for the user or group. This is intended to be used in overlays where proper assignment does not take place but whose owners wish to switch to acct-* packages. While technically it is possible to choose a free UID/GID, it could be taken afterwards by some Gentoo package and unnecessarily introduce a conflict. Using '999' was also suggested (as the first dynamic UID/GID) but it would cause issues for people enabling ACCT_*_ENFORCE_ID. To avoid this, '-1' does not trigger collision checks. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/acct-group.eclass')
-rw-r--r--eclass/acct-group.eclass4
1 files changed, 4 insertions, 0 deletions
diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 9eab00db690..d5ccd209c9e 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -59,6 +59,9 @@ readonly ACCT_GROUP_NAME
# @DESCRIPTION:
# Preferred GID for the new group. This variable is obligatory, and its
# value must be unique across all group packages.
+#
+# Overlays should set this to -1 to dynamically allocate GID. Using -1
+# in ::gentoo is prohibited by policy.
# @ECLASS-VARIABLE: ACCT_GROUP_ENFORCE_ID
# @DESCRIPTION:
@@ -87,6 +90,7 @@ acct-group_pkg_pretend() {
# verify ACCT_GROUP_ID
[[ -n ${ACCT_GROUP_ID} ]] || die "Ebuild error: ACCT_GROUP_ID must be set!"
+ [[ ${ACCT_GROUP_ID} -eq -1 ]] && return
[[ ${ACCT_GROUP_ID} -ge 0 ]] || die "Ebuild errors: ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!"
# check for ACCT_GROUP_ID collisions early