acct-user.eclass: Skip locking if account does not exist
authorMichał Górny <mgorny@gentoo.org>
Fri, 5 Jul 2019 10:01:39 +0000 (12:01 +0200)
committerMichał Górny <mgorny@gentoo.org>
Fri, 5 Jul 2019 15:44:19 +0000 (17:44 +0200)
Closes: https://bugs.gentoo.org/689308
Signed-off-by: Michał Górny <mgorny@gentoo.org>
eclass/acct-user.eclass

index 1b8a0bf94a622a9594f19f453ca0138f5771e6fc..2df00a8730eb222cbb4e9f7f1a1799c1d4ec9357 100644 (file)
@@ -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)"