Gentoo Archives: gentoo-dev

From: Francesco Riosa <vivo75@×××××.com>
To: gentoo-dev@l.g.o, heroxbd@g.o
Subject: Re: [gentoo-dev] [RFC, PATCH] user.eclass: gracefully return when unprivileged
Date: Tue, 21 Nov 2017 09:49:29
Message-Id: c1061d42-9928-5350-4cb8-3a89f9f9d7ee@gmail.com
In Reply to: [gentoo-dev] [RFC, PATCH] user.eclass: gracefully return when unprivileged by heroxbd@gentoo.org
1 On 11/20/17 05:09, heroxbd@g.o wrote:
2 [...]
3 > diff --git a/eclass/user.eclass b/eclass/user.eclass
4 > index 86bcd282479..76a622df698 100644
5 > --- a/eclass/user.eclass
6 > +++ b/eclass/user.eclass
7 > @@ -103,6 +103,10 @@ egetent() {
8 > # Default uid is (pass -1 for this) next available, default shell is
9 > # /bin/false, default homedir is /dev/null, and there are no default groups.
10 > enewuser() {
11 > + if [[ ${EUID} != 0 ]] ; then
12 > + einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
13 maybe ewarn() is more appropriate than einfo()?
14 Just in case it's executed outside the scope of prefix
15
16 [...]

Replies