user eclass: Ignore shell and homedir from portage-stable packages.
These fields are provided by:
profiles/base/accounts/user/*
and don't need to be kept from portage-stable.
CQ-DEPEND=CL:1490411,CL:1491946
BUG=chromium:935669,chromium:933582
TEST=sudo rm -rf /board/${BOARD} && ./setup_board --board=${BOARD} &&
./build_packages --board=${BOARD} --skip_chroot_upgrade --nousepkg &&
build image, flash image, make sure ssh works.
Change-Id: Icffc3bf4935c88f308a5129c136e32ea0d6c9614
Reviewed-on: https://chromium-review.googlesource.com/1487713
Commit-Ready: Allen Webb <allenwebb@google.com>
Tested-by: Allen Webb <allenwebb@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 3c7ec63..3874fb6 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -381,10 +381,10 @@
# handle shell
local eshell=$1; shift
if [[ -n ${eshell} && ${eshell} != "-1" ]] ; then
- if [[ ${eshell} == */false || ${eshell} == */nologin ]] ; then
- eerror "Do not specify ${eshell} yourself, use -1"
- die "Pass '-1' as the shell parameter"
- fi
+ # We might need to relax this for portage-stable if there
+ # are any packages that we want to allow to set a custom shell.
+ eerror "Do not specify ${eshell} yourself, use -1"
+ die "Pass '-1' as the shell parameter"
else
eshell=$(_get_value_for_user "${euser}" shell)
${eshell:=/bin/false}
@@ -399,6 +399,15 @@
# handle homedir
local ehome=$1; shift
+ if [[ ${ehome:--1} != "-1" ]] ; then
+ if [[ "${PORTAGE_REPO_NAME}" != "portage-stable" ]] ; then
+ die "Pass -1 as the home directory"
+ else
+ # If caller is from portage-stable, ignore specified homedir.
+ einfo "Ignoring requested homedir ${ehome} in portage-stable ebuilds."
+ ehome=''
+ fi
+ fi
if [[ -z ${ehome} || ${ehome} == "-1" ]] ; then
ehome=$(_get_value_for_user "${euser}" home)
fi