Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 354806 Details for
Bug 479384
user.eclass does not respect $ROOT when manipulating users / groups (patch supplied)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to make user.eclass respect $ROOT when manipulating users / groups
user.eclass.patch (text/plain), 2.47 KB, created by
Max Hacking
on 2013-08-01 11:16:31 UTC
(
hide
)
Description:
Patch to make user.eclass respect $ROOT when manipulating users / groups
Filename:
MIME Type:
Creator:
Max Hacking
Created:
2013-08-01 11:16:31 UTC
Size:
2.47 KB
patch
obsolete
>--- /mnt/portage/portage/eclass/user.eclass 2012-06-22 21:31:13.000000000 +0200 >+++ /home/max/eclipse-workspaces/overlay/hacking-gentoo-overlay/eclass/user.eclass 2013-07-31 22:44:40.226945383 +0200 >@@ -16,6 +16,10 @@ > if [[ ${___ECLASS_ONCE_USER} != "recur -_+^+_- spank" ]] ; then > ___ECLASS_ONCE_USER="recur -_+^+_- spank" > >+DEPEND="sys-auth/pambase >+ sys-apps/shadow" >+RDEPEND="${DEPEND}" >+ > # @FUNCTION: _assert_pkg_ebuild_phase > # @INTERNAL > # @USAGE: <calling func name> >@@ -92,9 +96,15 @@ > grep "${key}:\*:" /etc/${db} > ;; > *) >- # ignore output if nscd doesn't exist, or we're not running as root >- nscd -i "${db}" 2>/dev/null >- getent "${db}" "${key}" >+ # If we are installing to a root other than / the normal getent >+ # won't work so we'll have to grep the database instead. >+ if [[ -n ${ROOT} ]] && [[ ${ROOT} != "/" ]]; then >+ [[ -f ${ROOT}/etc/${db} ]] && grep "${key}:*:" ${ROOT}/etc/${db} >+ else >+ # ignore output if nscd doesn't exist, or we're not running as root >+ nscd -i "${db}" 2>/dev/null >+ getent "${db}" "${key}" >+ fi > ;; > esac > } >@@ -118,9 +128,10 @@ > > # lets see if the username already exists > if [[ -n $(egetent passwd "${euser}") ]] ; then >+ einfo "User '${euser}' already present [at ${ROOT}]..." > return 0 > fi >- einfo "Adding user '${euser}' to your system ..." >+ einfo "Adding user '${euser}' to your system [at ${ROOT}]..." > > # options to pass to useradd > local opts=() >@@ -247,7 +258,7 @@ > ;; > > *) >- useradd -r "${opts[@]}" "${euser}" || die >+ useradd -R ${ROOT} -r "${opts[@]}" "${euser}" || die > ;; > esac > >@@ -278,9 +289,10 @@ > > # see if group already exists > if [[ -n $(egetent group "${egroup}") ]] ; then >+ einfo "Group '${egroup}' already present [at ${ROOT}]..." > return 0 > fi >- einfo "Adding group '${egroup}' to your system ..." >+ einfo "Adding group '${egroup}' to your system [at ${ROOT}]..." > > # handle gid > local egid=$1; shift >@@ -340,7 +352,7 @@ > opts="-g ${egid}" > fi > # We specify -r so that we get a GID in the system range from login.defs >- groupadd -r ${opts} "${egroup}" || die >+ groupadd -R ${ROOT} -r ${opts} "${egroup}" || die > ;; > esac > } >@@ -454,7 +466,7 @@ > ;; > > *) >- usermod -d "${ehome}" "${euser}" && return 0 >+ usermod -R ${ROOT} -d "${ehome}" "${euser}" && return 0 > [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home" > eerror "There was an error when attempting to update the home directory for ${euser}" > eerror "Please update it manually on your system (as root):"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 479384
: 354806