1 |
Closes: https://bugs.gentoo.org/886147 |
2 |
Closes: https://github.com/gentoo/gentoo/pull/28744 |
3 |
Signed-off-by: Mike Gilbert <floppym@g.o> |
4 |
--- |
5 |
eclass/acct-user.eclass | 51 ++++++++++++++++++++--------------------- |
6 |
1 file changed, 25 insertions(+), 26 deletions(-) |
7 |
|
8 |
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
9 |
index a37e12121f8..14fda76ced7 100644 |
10 |
--- a/eclass/acct-user.eclass |
11 |
+++ b/eclass/acct-user.eclass |
12 |
@@ -339,36 +339,35 @@ acct-user_pkg_preinst() { |
13 |
|
14 |
if egetent passwd "${ACCT_USER_NAME}" >/dev/null; then |
15 |
elog "User ${ACCT_USER_NAME} already exists" |
16 |
- return |
17 |
- fi |
18 |
- |
19 |
- local groups=( ${_ACCT_USER_GROUPS} ) |
20 |
- local aux_groups=${groups[*]:1} |
21 |
- local opts=( |
22 |
- --system |
23 |
- --no-create-home |
24 |
- --no-user-group |
25 |
- --comment "${_ACCT_USER_COMMENT}" |
26 |
- --home-dir "${_ACCT_USER_HOME}" |
27 |
- --shell "${_ACCT_USER_SHELL}" |
28 |
- --gid "${groups[0]}" |
29 |
- --groups "${aux_groups// /,}" |
30 |
- ) |
31 |
+ else |
32 |
+ local groups=( ${_ACCT_USER_GROUPS} ) |
33 |
+ local aux_groups=${groups[*]:1} |
34 |
+ local opts=( |
35 |
+ --system |
36 |
+ --no-create-home |
37 |
+ --no-user-group |
38 |
+ --comment "${_ACCT_USER_COMMENT}" |
39 |
+ --home-dir "${_ACCT_USER_HOME}" |
40 |
+ --shell "${_ACCT_USER_SHELL}" |
41 |
+ --gid "${groups[0]}" |
42 |
+ --groups "${aux_groups// /,}" |
43 |
+ ) |
44 |
+ |
45 |
+ if [[ ${_ACCT_USER_ID} -ne -1 ]] && |
46 |
+ ! egetent passwd "${_ACCT_USER_ID}" >/dev/null |
47 |
+ then |
48 |
+ opts+=( --uid "${_ACCT_USER_ID}" ) |
49 |
+ fi |
50 |
|
51 |
- if [[ ${_ACCT_USER_ID} -ne -1 ]] && |
52 |
- ! egetent passwd "${_ACCT_USER_ID}" >/dev/null |
53 |
- then |
54 |
- opts+=( --uid "${_ACCT_USER_ID}" ) |
55 |
- fi |
56 |
+ if [[ -n ${ROOT} ]]; then |
57 |
+ opts+=( --prefix "${ROOT}" ) |
58 |
+ fi |
59 |
|
60 |
- if [[ -n ${ROOT} ]]; then |
61 |
- opts+=( --prefix "${ROOT}" ) |
62 |
+ elog "Adding user ${ACCT_USER_NAME}" |
63 |
+ useradd "${opts[@]}" "${ACCT_USER_NAME}" || die |
64 |
+ _ACCT_USER_ADDED=1 |
65 |
fi |
66 |
|
67 |
- elog "Adding user ${ACCT_USER_NAME}" |
68 |
- useradd "${opts[@]}" "${ACCT_USER_NAME}" || die |
69 |
- _ACCT_USER_ADDED=1 |
70 |
- |
71 |
if [[ ${_ACCT_USER_HOME} != /dev/null ]]; then |
72 |
# default ownership to user:group |
73 |
if [[ -z ${_ACCT_USER_HOME_OWNER} ]]; then |
74 |
-- |
75 |
2.39.0 |