All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 2/7] shadow: add a -native recipe with customized utilities
Date: Fri, 02 Sep 2011 15:03:31 +0100	[thread overview]
Message-ID: <1314972211.5939.604.camel@rex> (raw)
In-Reply-To: <1314957057.19905.224.camel@phil-desktop>

On Fri, 2011-09-02 at 10:50 +0100, Phil Blundell wrote:
> 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.

It looks like the useradd_sysroot code will work since D is set to
'something' and then is set correctly in the preinst. What won't work
correctly is the rootfs user creation as you point out.

So I'd agree with your change.

> 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?

Write it in python? ;-)

Seriously, does opkg have the logic in it to run this stuff? If so
perhaps we need to teach opkg about offline postinstalls since it should
already know about dependencies?

Cheers,

Richard





  reply	other threads:[~2011-09-02 14:08 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 18:13 [PATCH 0/7] User/group creation at preinstall Scott Garman
2011-05-31 19:53 ` Scott Garman
2011-05-31 18:13 ` [PATCH 1/7] shadow: recipe and patch cleanup Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-05-31 18:13 ` [PATCH 2/7] shadow: add a -native recipe with customized utilities Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-06-01  9:47   ` Phil Blundell
2011-06-01 12:34     ` Martyn Welch
2011-06-01 13:42       ` Phil Blundell
2011-06-01 17:43     ` Scott Garman
2011-06-01 21:05       ` Mark Hatle
2011-06-02 11:19         ` Phil Blundell
2011-09-01 14:46   ` Phil Blundell
2011-09-01 16:41   ` Phil Blundell
2011-09-01 16:54     ` Mark Hatle
2011-09-01 16:58       ` Phil Blundell
2011-09-01 17:25         ` Mark Hatle
2011-09-01 19:44           ` Phil Blundell
2011-09-01 21:59             ` Richard Purdie
2011-09-02  0:02               ` Mark Hatle
2011-09-02  7:15               ` Phil Blundell
2011-09-02  9:50               ` Phil Blundell
2011-09-02 14:03                 ` Richard Purdie [this message]
2011-09-02 18:43                   ` Phil Blundell
2011-09-02 19:17                     ` Mark Hatle
2011-05-31 18:13 ` [PATCH 3/7] base-passwd: add -cross recipe with default login.defs Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-05-31 18:13 ` [PATCH 4/7] useradd.bbclass: new class for managing user/group permissions Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-05-31 18:13 ` [PATCH 5/7] useradd-example: example recipe for using inherit useradd Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-05-31 19:09   ` Mark Hatle
2011-05-31 18:13 ` [PATCH 6/7] bitbake.conf: set PSEUDO_PASSWD within FAKEROOTENV Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-05-31 18:13 ` [PATCH 7/7] package_rpm.bbclass: make RPM use on-disk permissions Scott Garman
2011-05-31 19:53   ` Scott Garman
2011-05-31 18:45 ` [poky] [PATCH 0/7] User/group creation at preinstall Koen Kooi
2011-05-31 18:45   ` Koen Kooi
2011-05-31 19:06   ` [poky] " Saul Wold
2011-05-31 19:06     ` Saul Wold
2011-05-31 19:09     ` Mark Hatle
2011-05-31 19:51     ` [poky] " Scott Garman
2011-05-31 19:51       ` Scott Garman
2011-05-31 19:57       ` [poky] " Otavio Salvador
2011-05-31 21:16         ` Mark Hatle
2011-05-31 21:16           ` [OE-core] " Mark Hatle
2011-05-31 21:27           ` [poky] " Scott Garman
2011-05-31 21:51             ` Richard Purdie
2011-05-31 21:25       ` Richard Purdie
2011-05-31 21:25         ` [OE-core] " Richard Purdie
2011-06-02 23:50 [PATCH 0/7] User/group creation at preinstall v2 Scott Garman
2011-06-02 23:50 ` [PATCH 2/7] shadow: add a -native recipe with customized utilities Scott Garman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314972211.5939.604.camel@rex \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.