1 |
From: Benda Xu <heroxbd@g.o> |
2 |
|
3 |
Thanks MJ, how about "Unprivileged to execute"? Less bytes. |
4 |
|
5 |
enewgroup and enewuser does not apply when executed as a normal |
6 |
user, e.g. under Gentoo Prefix. |
7 |
--- |
8 |
eclass/user.eclass | 8 ++++++++ |
9 |
1 file changed, 8 insertions(+) |
10 |
|
11 |
diff --git a/eclass/user.eclass b/eclass/user.eclass |
12 |
index 86bcd282479..8ff06935277 100644 |
13 |
--- a/eclass/user.eclass |
14 |
+++ b/eclass/user.eclass |
15 |
@@ -103,6 +103,10 @@ egetent() { |
16 |
# Default uid is (pass -1 for this) next available, default shell is |
17 |
# /bin/false, default homedir is /dev/null, and there are no default groups. |
18 |
enewuser() { |
19 |
+ if [[ ${EUID} != 0 ]] ; then |
20 |
+ einfo "Unprivileged to execute ${FUNCNAME[0]}" |
21 |
+ return 0 |
22 |
+ fi |
23 |
_assert_pkg_ebuild_phase ${FUNCNAME} |
24 |
|
25 |
# get the username |
26 |
@@ -262,6 +266,10 @@ enewuser() { |
27 |
# do the rest. You may specify the gid for the group or allow the group to |
28 |
# allocate the next available one. |
29 |
enewgroup() { |
30 |
+ if [[ ${EUID} != 0 ]] ; then |
31 |
+ einfo "Unprivileged to execute ${FUNCNAME[0]}" |
32 |
+ return 0 |
33 |
+ fi |
34 |
_assert_pkg_ebuild_phase ${FUNCNAME} |
35 |
|
36 |
# get the group |
37 |
-- |
38 |
2.15.0 |