mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-16 01:16:59 +02:00
eclass/acct-user: Sync with Gentoo
It's from Gentoo commit b7e37226a665a0613facd10386bbbbec8696699e.
This commit is contained in:
parent
45b136c461
commit
783b25c21e
@ -1,4 +1,4 @@
|
|||||||
# Copyright 2019-2023 Gentoo Authors
|
# Copyright 2019-2024 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: acct-user.eclass
|
# @ECLASS: acct-user.eclass
|
||||||
@ -58,12 +58,12 @@ inherit user-info
|
|||||||
# << Eclass variables >>
|
# << Eclass variables >>
|
||||||
|
|
||||||
# @ECLASS_VARIABLE: ACCT_USER_NAME
|
# @ECLASS_VARIABLE: ACCT_USER_NAME
|
||||||
# @INTERNAL
|
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# The name of the user. This is forced to ${PN} and the policy prohibits
|
# The name of the user. This is forced to ${PN} and the policy
|
||||||
# it from being changed.
|
# prohibits it from being changed. The variable is left writable for
|
||||||
|
# use in overlays; package naming restrictions would prohibit some
|
||||||
|
# otherwise-valid usernames.
|
||||||
ACCT_USER_NAME=${PN}
|
ACCT_USER_NAME=${PN}
|
||||||
readonly ACCT_USER_NAME
|
|
||||||
|
|
||||||
# @ECLASS_VARIABLE: ACCT_USER_ID
|
# @ECLASS_VARIABLE: ACCT_USER_ID
|
||||||
# @REQUIRED
|
# @REQUIRED
|
||||||
@ -231,8 +231,9 @@ acct-user_pkg_pretend() {
|
|||||||
[[ ${ACCT_USER_ID} -ge -1 ]] || die "Ebuild error: ACCT_USER_ID=${ACCT_USER_ID} invalid!"
|
[[ ${ACCT_USER_ID} -ge -1 ]] || die "Ebuild error: ACCT_USER_ID=${ACCT_USER_ID} invalid!"
|
||||||
local user_id=${ACCT_USER_ID}
|
local user_id=${ACCT_USER_ID}
|
||||||
|
|
||||||
# check for the override
|
# check for the override, use PN in case this is an overlay and
|
||||||
local override_name=${ACCT_USER_NAME^^}
|
# ACCT_USER_NAME is not PN and not valid in a bash variable name
|
||||||
|
local override_name=${PN^^}
|
||||||
local override_var=ACCT_USER_${override_name//-/_}_ID
|
local override_var=ACCT_USER_${override_name//-/_}_ID
|
||||||
if [[ -n ${!override_var} ]]; then
|
if [[ -n ${!override_var} ]]; then
|
||||||
user_id=${!override_var}
|
user_id=${!override_var}
|
||||||
@ -274,8 +275,9 @@ acct-user_src_install() {
|
|||||||
# serialize for override support
|
# serialize for override support
|
||||||
local ACCT_USER_GROUPS=${ACCT_USER_GROUPS[*]}
|
local ACCT_USER_GROUPS=${ACCT_USER_GROUPS[*]}
|
||||||
|
|
||||||
# support make.conf overrides
|
# support make.conf overrides, use PN in case this is an overlay and
|
||||||
local override_name=${ACCT_USER_NAME^^}
|
# ACCT_USER_NAME is not PN and not valid in a bash variable name
|
||||||
|
local override_name=${PN^^}
|
||||||
override_name=${override_name//-/_}
|
override_name=${override_name//-/_}
|
||||||
local var
|
local var
|
||||||
for var in ACCT_USER_{ID,COMMENT,SHELL,HOME{,_OWNER,_PERMS},GROUPS}; do
|
for var in ACCT_USER_{ID,COMMENT,SHELL,HOME{,_OWNER,_PERMS},GROUPS}; do
|
||||||
@ -437,7 +439,7 @@ acct-user_pkg_postinst() {
|
|||||||
has "${g}" "${groups[@]}" || del_groups+="${del_groups:+, }${g}"
|
has "${g}" "${groups[@]}" || del_groups+="${del_groups:+, }${g}"
|
||||||
done
|
done
|
||||||
if [[ -n ${del_groups} ]]; then
|
if [[ -n ${del_groups} ]]; then
|
||||||
local override_name=${ACCT_USER_NAME^^}
|
local override_name=${PN^^}
|
||||||
override_name=${override_name//-/_}
|
override_name=${override_name//-/_}
|
||||||
ewarn "Removing user ${ACCT_USER_NAME} from group(s): ${del_groups}"
|
ewarn "Removing user ${ACCT_USER_NAME} from group(s): ${del_groups}"
|
||||||
ewarn "To retain the user's group membership in the local system"
|
ewarn "To retain the user's group membership in the local system"
|
||||||
|
Loading…
Reference in New Issue
Block a user