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