1 |
Allow a special value of '-1' to dynamically assign UID/GID for the user |
2 |
or group. This is intended to be used in overlays where proper |
3 |
assignment does not take place but whose owners wish to switch to acct-* |
4 |
packages. |
5 |
|
6 |
While technically it is possible to choose a free UID/GID, it could be |
7 |
taken afterwards by some Gentoo package and unnecessarily introduce |
8 |
a conflict. Using '999' was also suggested (as the first dynamic |
9 |
UID/GID) but it would cause issues for people enabling |
10 |
ACCT_*_ENFORCE_ID. To avoid this, '-1' does not trigger collision |
11 |
checks. |
12 |
|
13 |
Signed-off-by: Michał Górny <mgorny@g.o> |
14 |
--- |
15 |
eclass/acct-group.eclass | 4 ++++ |
16 |
eclass/acct-user.eclass | 4 ++++ |
17 |
2 files changed, 8 insertions(+) |
18 |
|
19 |
diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass |
20 |
index 9eab00db690f..d5ccd209c9e3 100644 |
21 |
--- a/eclass/acct-group.eclass |
22 |
+++ b/eclass/acct-group.eclass |
23 |
@@ -59,6 +59,9 @@ readonly ACCT_GROUP_NAME |
24 |
# @DESCRIPTION: |
25 |
# Preferred GID for the new group. This variable is obligatory, and its |
26 |
# value must be unique across all group packages. |
27 |
+# |
28 |
+# Overlays should set this to -1 to dynamically allocate GID. Using -1 |
29 |
+# in ::gentoo is prohibited by policy. |
30 |
|
31 |
# @ECLASS-VARIABLE: ACCT_GROUP_ENFORCE_ID |
32 |
# @DESCRIPTION: |
33 |
@@ -87,6 +90,7 @@ acct-group_pkg_pretend() { |
34 |
|
35 |
# verify ACCT_GROUP_ID |
36 |
[[ -n ${ACCT_GROUP_ID} ]] || die "Ebuild error: ACCT_GROUP_ID must be set!" |
37 |
+ [[ ${ACCT_GROUP_ID} -eq -1 ]] && return |
38 |
[[ ${ACCT_GROUP_ID} -ge 0 ]] || die "Ebuild errors: ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!" |
39 |
|
40 |
# check for ACCT_GROUP_ID collisions early |
41 |
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
42 |
index 60009643c144..17a58e9126e4 100644 |
43 |
--- a/eclass/acct-user.eclass |
44 |
+++ b/eclass/acct-user.eclass |
45 |
@@ -67,6 +67,9 @@ readonly ACCT_USER_NAME |
46 |
# @DESCRIPTION: |
47 |
# Preferred UID for the new user. This variable is obligatory, and its |
48 |
# value must be unique across all user packages. |
49 |
+# |
50 |
+# Overlays should set this to -1 to dynamically allocate GID. Using -1 |
51 |
+# in ::gentoo is prohibited by policy. |
52 |
|
53 |
# @ECLASS-VARIABLE: ACCT_USER_ENFORCE_ID |
54 |
# @DESCRIPTION: |
55 |
@@ -279,6 +282,7 @@ acct-user_pkg_pretend() { |
56 |
|
57 |
# verify ACCT_USER_ID |
58 |
[[ -n ${ACCT_USER_ID} ]] || die "Ebuild error: ACCT_USER_ID must be set!" |
59 |
+ [[ ${ACCT_USER_ID} -eq -1 ]] && return |
60 |
[[ ${ACCT_USER_ID} -ge 0 ]] || die "Ebuild errors: ACCT_USER_ID=${ACCT_USER_ID} invalid!" |
61 |
|
62 |
# check for ACCT_USER_ID collisions early |
63 |
-- |
64 |
2.23.0.rc1 |