Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] acct-user.eclass: Skip locking if account does not exist
Date: Fri, 05 Jul 2019 10:03:16
Message-Id: 20190705100223.10441-1-mgorny@gentoo.org
1 Closes: https://bugs.gentoo.org/689308
2 Signed-off-by: Michał Górny <mgorny@g.o>
3 ---
4 eclass/acct-user.eclass | 6 ++++++
5 1 file changed, 6 insertions(+)
6
7 diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
8 index 1b8a0bf94a62..b63f6d668a8e 100644
9 --- a/eclass/acct-user.eclass
10 +++ b/eclass/acct-user.eclass
11 @@ -363,6 +363,12 @@ acct-user_pkg_prerm() {
12 debug-print-function ${FUNCNAME} "${@}"
13
14 if [[ -z ${REPLACED_BY_VERSION} ]]; then
15 + if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
16 + elog "User account not found: ${ACCT_USER_NAME}"
17 + elog "Locking process will be skipped."
18 + return
19 + fi
20 +
21 esetshell "${ACCT_USER_NAME}" -1
22 esetcomment "${ACCT_USER_NAME}" \
23 "$(egetcomment "${ACCT_USER_NAME}"); user account removed @ $(date +%Y-%m-%d)"
24 --
25 2.22.0