[OE-core] [PATCH 2/7] shadow: add a -native recipe with customized utilities

Phil Blundell philb at gnu.org
Fri Sep 2 09:50:56 UTC 2011


On Thu, 2011-09-01 at 22:59 +0100, Richard Purdie wrote:
> The latter sounds like what we'll need to do. I haven't looked at shadow
> to see what kind of finessing is required though...

Fixing the immediate problem with shadow turned out to be rather
straightforward, see attached.  However, with this done, I now encounter
two new issues.

1. the logic around $D in useradd.bbclass seems to be backwards to me
(and, empirically, isn't working because the supposedly-created users
are not showing up in my rootfs).  Specifically, it does:

        useradd_preinst () {
        OPT=""
        SYSROOT=""
        
        if test "x$D" != "x"; then
        	# Installing into a sysroot
        	SYSROOT="${STAGING_DIR_TARGET}"
        	OPT="--root ${STAGING_DIR_TARGET}"
        
        [...]
        
        useradd_sysroot () {
        	export PSEUDO="${STAGING_DIR_NATIVE}/usr/bin/pseudo"
        	export PSEUDO_LOCALSTATEDIR="${STAGING_DIR_TARGET}/var/pseudo"
        
        	# Explicitly set $D since it isn't set to anything
        	# before do_install
        	D=${D}
        	useradd_preinst
        }

It looks to me as though the code in useradd_preinst() should be using
SYSROOT="$D" (and likewise for OPT), and useradd_sysroot() should be
setting D=${STAGING_DIR_TARGET}.  But maybe there is some clever thing
going on here that I'm not properly understanding.

2. during rootfs construction, the script ordering is wrong.  All the
preinsts run before all the postinsts, which has always been a bit wrong
but hasn't caused too much of a problem in the past.  However,
crucially, this means that the useradd_preinst() runs before
base-passwd's postinst and hence /etc/passwd doesn't exist at the point
where useradd tries to modify it.

I can't think of any reasonable fix for (2) other than to teach
rootfs_ipk how to track package dependencies and run the scripts in the
right order.  I guess that wouldn't be impossible by any means but
trying to do it in a shell script is not a prospect that fills me with a
lot of enthusiasm.  Any better suggestions?

p.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: shadow.diff
Type: text/x-patch
Size: 1020 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20110902/36386264/attachment-0002.bin>


More information about the Openembedded-core mailing list