commit: 476e3eade829ef401bcc2eaf8ae7d0262f3d121f
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 14 01:59:53 2016 +0000
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Tue Jun 14 01:59:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/android.git/commit/?id=476e3ead
user.eclass: gracefully return early on for enewgroup and enewuser.
eclass/user.eclass | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 860aba0..9fddbbb 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -107,6 +107,10 @@ egetent() {
# Default uid is (pass -1 for this) next available, default shell is
# /bin/false, default homedir is /dev/null, and there are no default groups.
enewuser() {
+ if [[ ${EUID} != 0 ]] ; then
+ einfo "Donot have enough privilege to execute ${FUNCNAME[0]}"
+ return 0
+ fi
_assert_pkg_ebuild_phase ${FUNCNAME}
# get the username
@@ -247,7 +251,7 @@ enewuser() {
;;
*)
- useradd -r "${opts[@]}" "${euser}" || use prefix || die
+ useradd -r "${opts[@]}" "${euser}" || die
;;
esac
@@ -267,6 +271,10 @@ enewuser() {
# do the rest. You may specify the gid for the group or allow the group to
# allocate the next available one.
enewgroup() {
+ if [[ ${EUID} != 0 ]] ; then
+ einfo "Donot have enough privilege to execute ${FUNCNAME[0]}"
+ return 0
+ fi
_assert_pkg_ebuild_phase ${FUNCNAME}
# get the group
@@ -340,7 +348,7 @@ enewgroup() {
opts="-g ${egid}"
fi
# We specify -r so that we get a GID in the system range from
login.defs
- groupadd -r ${opts} "${egroup}" || use prefix || die
+ groupadd -r ${opts} "${egroup}" || die
;;
esac
}