Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [PATCH 2/2] acct-user.eclass: Don't modify users when EPREFIX is non-empty
Date: Thu, 08 Dec 2022 21:29:52
Message-Id: 20221208212854.3825-3-chewi@gentoo.org
In Reply to: [gentoo-dev] acct-*.eclass: Don't modify users/groups when EPREFIX is non-empty by James Le Cuirot
1 This was happening when running a prefix as root, which we don't really
2 support, but also when building a prefixed system under ROOT.
3
4 Signed-off-by: James Le Cuirot <chewi@g.o>
5 ---
6 eclass/acct-user.eclass | 8 ++++----
7 1 file changed, 4 insertions(+), 4 deletions(-)
8
9 diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
10 index b15599c5dd6f..a37e12121f83 100644
11 --- a/eclass/acct-user.eclass
12 +++ b/eclass/acct-user.eclass
13 @@ -181,7 +181,7 @@ acct-user_add_deps() {
14 eislocked() {
15 [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>"
16
17 - if [[ ${EUID} -ne 0 ]]; then
18 + if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
19 einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
20 return 0
21 fi
22 @@ -332,7 +332,7 @@ acct-user_pkg_preinst() {
23
24 unset _ACCT_USER_ADDED
25
26 - if [[ ${EUID} -ne 0 ]]; then
27 + if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
28 einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
29 return
30 fi
31 @@ -405,7 +405,7 @@ acct-user_pkg_postinst() {
32 return
33 fi
34
35 - if [[ ${EUID} -ne 0 ]]; then
36 + if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
37 einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
38 return
39 fi
40 @@ -454,7 +454,7 @@ acct-user_pkg_prerm() {
41 return
42 fi
43
44 - if [[ ${EUID} -ne 0 ]]; then
45 + if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
46 einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
47 return
48 fi
49 --
50 2.38.1