commit:     d61d24f4818eef45f8e7ba2e4a7c508ad5bdfb43
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  5 10:01:39 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul  5 15:44:19 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d61d24f4

acct-user.eclass: Skip locking if account does not exist

Closes: https://bugs.gentoo.org/689308
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/acct-user.eclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index 1b8a0bf94a6..2df00a8730e 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -363,6 +363,12 @@ acct-user_pkg_prerm() {
        debug-print-function ${FUNCNAME} "${@}"
 
        if [[ -z ${REPLACED_BY_VERSION} ]]; then
+               if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
+                       ewarn "User account not found: ${ACCT_USER_NAME}"
+                       ewarn "Locking process will be skipped."
+                       return
+               fi
+
                esetshell "${ACCT_USER_NAME}" -1
                esetcomment "${ACCT_USER_NAME}" \
                        "$(egetcomment "${ACCT_USER_NAME}"); user account 
removed @ $(date +%Y-%m-%d)"

Reply via email to