1 |
On 18/02/20 13:02, heroxbd@g.o wrote: |
2 |
> From: Benda Xu <heroxbd@g.o> |
3 |
> |
4 |
> Gentoo Prefix runs with a normal user and cannot manage any other user. |
5 |
> Exit gracefully with a message. |
6 |
> |
7 |
> Closes: https://bugs.gentoo.org/709570 |
8 |
> Signed-off-by: Benda Xu <heroxbd@g.o> |
9 |
> --- |
10 |
> eclass/acct-user.eclass | 10 ++++++++++ |
11 |
> 1 file changed, 10 insertions(+) |
12 |
> |
13 |
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
14 |
> index be6b3dd3e600..e3ec3966035d 100644 |
15 |
> --- a/eclass/acct-user.eclass |
16 |
> +++ b/eclass/acct-user.eclass |
17 |
> @@ -360,6 +360,11 @@ acct-user_pkg_preinst() { |
18 |
> acct-user_pkg_postinst() { |
19 |
> debug-print-function ${FUNCNAME} "${@}" |
20 |
> |
21 |
> + if [[ ${EUID} != 0 ]] ; then |
22 |
> + einfo "Insufficient privileges to execute ${FUNCNAME[0]}" |
23 |
> + return 0 |
24 |
> + fi |
25 |
> + |
26 |
> # NB: eset* functions check current value |
27 |
> esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}" |
28 |
> esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}" |
29 |
> @@ -376,6 +381,11 @@ acct-user_pkg_postinst() { |
30 |
> acct-user_pkg_prerm() { |
31 |
> debug-print-function ${FUNCNAME} "${@}" |
32 |
> |
33 |
> + if [[ ${EUID} != 0 ]] ; then |
34 |
> + einfo "Insufficient privileges to execute ${FUNCNAME[0]}" |
35 |
> + return 0 |
36 |
> + fi |
37 |
> + |
38 |
> if [[ -z ${REPLACED_BY_VERSION} ]]; then |
39 |
> if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then |
40 |
> ewarn "User account not found: ${ACCT_USER_NAME}" |
41 |
Peanut gallery says 'ACK' +1.... |