1 |
commit: 37420386c65f55b677aca4bcc1afb18bfe22ee73 |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 18 12:56:45 2020 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Feb 21 08:14:13 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37420386 |
7 |
|
8 |
eclass/acct-user.eclass: disable pkg_* on Prefix. |
9 |
|
10 |
Gentoo Prefix runs with a normal user and cannot manage any other user. |
11 |
Exit gracefully with a message. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/709570 |
14 |
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org> |
15 |
|
16 |
eclass/acct-user.eclass | 10 ++++++++++ |
17 |
1 file changed, 10 insertions(+) |
18 |
|
19 |
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
20 |
index be6b3dd3e60..e3ec3966035 100644 |
21 |
--- a/eclass/acct-user.eclass |
22 |
+++ b/eclass/acct-user.eclass |
23 |
@@ -360,6 +360,11 @@ acct-user_pkg_preinst() { |
24 |
acct-user_pkg_postinst() { |
25 |
debug-print-function ${FUNCNAME} "${@}" |
26 |
|
27 |
+ if [[ ${EUID} != 0 ]] ; then |
28 |
+ einfo "Insufficient privileges to execute ${FUNCNAME[0]}" |
29 |
+ return 0 |
30 |
+ fi |
31 |
+ |
32 |
# NB: eset* functions check current value |
33 |
esethome "${ACCT_USER_NAME}" "${ACCT_USER_HOME}" |
34 |
esetshell "${ACCT_USER_NAME}" "${ACCT_USER_SHELL}" |
35 |
@@ -376,6 +381,11 @@ acct-user_pkg_postinst() { |
36 |
acct-user_pkg_prerm() { |
37 |
debug-print-function ${FUNCNAME} "${@}" |
38 |
|
39 |
+ if [[ ${EUID} != 0 ]] ; then |
40 |
+ einfo "Insufficient privileges to execute ${FUNCNAME[0]}" |
41 |
+ return 0 |
42 |
+ fi |
43 |
+ |
44 |
if [[ -z ${REPLACED_BY_VERSION} ]]; then |
45 |
if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then |
46 |
ewarn "User account not found: ${ACCT_USER_NAME}" |