diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-10-19 15:33:23 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-10-19 15:34:32 +0200 |
commit | 7e1b7540778de89c5a95e67a3fc92a7e3aff072c (patch) | |
tree | 272ac362f014c24a5938cbc5252826c8cc9a7df0 /eclass/acct-user.eclass | |
parent | acct-user.eclass: Revert "inline useradd and usermod" (diff) | |
download | gentoo-7e1b7540778de89c5a95e67a3fc92a7e3aff072c.tar.gz gentoo-7e1b7540778de89c5a95e67a3fc92a7e3aff072c.tar.bz2 gentoo-7e1b7540778de89c5a95e67a3fc92a7e3aff072c.zip |
acct-user.eclass: Revert "respect ACCT_USER_NO_MODIFY in pkg_prerm"
Reverts: 720c70288cf15946f2560af7d104e1b3f34f9dd9
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/acct-user.eclass')
-rw-r--r-- | eclass/acct-user.eclass | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index 6e7f6811a76f..f48e5a105a46 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -508,35 +508,28 @@ acct-user_pkg_postinst() { acct-user_pkg_prerm() { debug-print-function ${FUNCNAME} "${@}" - if [[ -n ${REPLACED_BY_VERSION} ]]; then - return - fi - if [[ ${EUID} -ne 0 ]]; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" - return + return 0 fi if [[ ${ACCT_USER_ID} -eq 0 ]]; then elog "Refusing to lock out the superuser (UID 0)" - return + return 0 fi - if [[ -n ${ACCT_USER_NO_MODIFY} ]]; then - elog "Not locking user ${ACCT_USER_NAME} due to ACCT_USER_NO_MODIFY" - return - fi + 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 - if ! egetent passwd "${ACCT_USER_NAME}" >/dev/null; then - ewarn "User account not found: ${ACCT_USER_NAME}" - ewarn "Locking process will be skipped." - return + esetshell "${ACCT_USER_NAME}" -1 + esetcomment "${ACCT_USER_NAME}" \ + "$(egetcomment "${ACCT_USER_NAME}"); user account removed @ $(date +%Y-%m-%d)" + elockuser "${ACCT_USER_NAME}" fi - - esetshell "${ACCT_USER_NAME}" -1 - esetcomment "${ACCT_USER_NAME}" \ - "$(egetcomment "${ACCT_USER_NAME}"); user account removed @ $(date +%Y-%m-%d)" - elockuser "${ACCT_USER_NAME}" } fi |