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