commit:     eabd386679e85e14532642e4fd03585acb6e881a
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  8 09:20:54 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Wed Dec 14 22:08:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eabd3866

acct-user.eclass: Don't modify users when EPREFIX is non-empty

This was happening when running a prefix as root, which we don't really
support, but also when building a prefixed system under ROOT.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 eclass/acct-user.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index b15599c5dd6f..a37e12121f83 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -181,7 +181,7 @@ acct-user_add_deps() {
 eislocked() {
        [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>"
 
-       if [[ ${EUID} -ne 0 ]]; then
+       if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
                einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
                return 0
        fi
@@ -332,7 +332,7 @@ acct-user_pkg_preinst() {
 
        unset _ACCT_USER_ADDED
 
-       if [[ ${EUID} -ne 0 ]]; then
+       if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
                einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
                return
        fi
@@ -405,7 +405,7 @@ acct-user_pkg_postinst() {
                return
        fi
 
-       if [[ ${EUID} -ne 0 ]]; then
+       if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
                einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
                return
        fi
@@ -454,7 +454,7 @@ acct-user_pkg_prerm() {
                return
        fi
 
-       if [[ ${EUID} -ne 0 ]]; then
+       if [[ ${EUID} -ne 0 || -n ${EPREFIX} ]]; then
                einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
                return
        fi

Reply via email to