Patchwork [1/1] wic: add pseudo to the populate-extfs step

login
register
mail settings
Submitter tom.zanussi@linux.intel.com
Date Oct. 16, 2013, 8:25 p.m.
Message ID <fd09f894b40dadb8bc8b267a26dbf52e22a53d66.1381954954.git.tom.zanussi@linux.intel.com>
Download mbox | patch
Permalink /patch/60041/
State Accepted
Commit 24a6b1324965080fef6c363edcb37768090eebea
Headers show

Comments

tom.zanussi@linux.intel.com - Oct. 16, 2013, 8:25 p.m.
Without this, files in the generated filesystem pick up the wrong
ownership.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Darren Hart - Oct. 16, 2013, 9:13 p.m.
On Wed, 2013-10-16 at 15:25 -0500, Tom Zanussi wrote:
> Without this, files in the generated filesystem pick up the wrong
> ownership.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  scripts/lib/mic/kickstart/custom_commands/partition.py | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> index 302cace..0eb0671 100644
> --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> @@ -216,7 +216,14 @@ class Wic_PartData(Mic_PartData):
>          """
>          Prepare content for an ext2/3/4 rootfs partition.
>          """
> -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
> +        populate_script = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
> +        populate_script += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir
> +        populate_script += "export PSEUDO_PASSWD=%s;" % rootfs_dir
> +        populate_script += "export PSEUDO_NOSYMLINKEXP=1;"
> +        populate_script += "export PSEUDO_DISABLED=0;"
> +        populate_script += "%s/usr/bin/pseudo %s/usr/bin/populate-extfs.sh" % \
> +            (native_sysroot, native_sysroot)
> +
>          image_extra_space = 10240
>  
>          image_rootfs = rootfs_dir

This resolved the failure to login permissions issue.

Acked-by: Darren Hart <dvhart@linux.intel.com>
Richard Purdie - Oct. 18, 2013, 3:04 p.m.
On Wed, 2013-10-16 at 15:25 -0500, Tom Zanussi wrote:
> Without this, files in the generated filesystem pick up the wrong
> ownership.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  scripts/lib/mic/kickstart/custom_commands/partition.py | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> index 302cace..0eb0671 100644
> --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> @@ -216,7 +216,14 @@ class Wic_PartData(Mic_PartData):
>          """
>          Prepare content for an ext2/3/4 rootfs partition.
>          """
> -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
> +        populate_script = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
> +        populate_script += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir
> +        populate_script += "export PSEUDO_PASSWD=%s;" % rootfs_dir
> +        populate_script += "export PSEUDO_NOSYMLINKEXP=1;"
> +        populate_script += "export PSEUDO_DISABLED=0;"
> +        populate_script += "%s/usr/bin/pseudo %s/usr/bin/populate-extfs.sh" % \
> +            (native_sysroot, native_sysroot)
> +
>          image_extra_space = 10240
>  
>          image_rootfs = rootfs_dir

I've merged this but I would like to figure out why pseudo can't manage
more sane defaults rather than needing all of those variables...

Cheers,

Richard
Mark Hatle - Oct. 18, 2013, 3:10 p.m.
On 10/18/13 10:04 AM, Richard Purdie wrote:
> On Wed, 2013-10-16 at 15:25 -0500, Tom Zanussi wrote:
>> Without this, files in the generated filesystem pick up the wrong
>> ownership.
>>
>> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
>> ---
>>   scripts/lib/mic/kickstart/custom_commands/partition.py | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
>> index 302cace..0eb0671 100644
>> --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
>> +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
>> @@ -216,7 +216,14 @@ class Wic_PartData(Mic_PartData):
>>           """
>>           Prepare content for an ext2/3/4 rootfs partition.
>>           """
>> -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
>> +        populate_script = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
>> +        populate_script += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir
>> +        populate_script += "export PSEUDO_PASSWD=%s;" % rootfs_dir

Location of the passwd file, if we are in a chroot, it will use the chroot'd 
version, otherwise you need to tell pseudo where it is.

>> +        populate_script += "export PSEUDO_NOSYMLINKEXP=1;"

This controls how the symlinks are populated from the point of view of 
non-pseudo environment.  If you intend to manipulate the results (and make them 
useful) -outside- of the pseudo environment, you need this.  If you do all of 
your operations from within pseudo, the defaults are correct.  Otherwise you can 
get links such as "/bin/sh -> /bin/bash" and it points to the host's bash, not 
the chroot's /bin/bash.

>> +        populate_script += "export PSEUDO_DISABLED=0;"

This shouldn't have to be set, unless the disabled has been previously set in 
the environment.

>> +        populate_script += "%s/usr/bin/pseudo %s/usr/bin/populate-extfs.sh" % \
>> +            (native_sysroot, native_sysroot)
>> +
>>           image_extra_space = 10240
>>
>>           image_rootfs = rootfs_dir
>
> I've merged this but I would like to figure out why pseudo can't manage
> more sane defaults rather than needing all of those variables...
>
> Cheers,
>
> Richard
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
Peter Seebach - Oct. 18, 2013, 8:03 p.m.
On Fri, 18 Oct 2013 16:04:30 +0100
Richard Purdie <richard.purdie@linuxfoundation.org> wrote:

> > -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
> > +        populate_script = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
> > +        populate_script += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir
> > +        populate_script += "export PSEUDO_PASSWD=%s;" % rootfs_dir
> > +        populate_script += "export PSEUDO_NOSYMLINKEXP=1;"
> > +        populate_script += "export PSEUDO_DISABLED=0;"
> > +        populate_script += "%s/usr/bin/pseudo %s/usr/bin/populate-extfs.sh" % \
> > +            (native_sysroot, native_sysroot)
> > +
> >          image_extra_space = 10240
> >  
> >          image_rootfs = rootfs_dir  
> 
> I've merged this but I would like to figure out why pseudo can't manage
> more sane defaults rather than needing all of those variables...

Good question. Historical answer:

You need PREFIX to figure out where libpseudo.so is. LOCALSTATEDIR is there
becaus one copy of libpseudo.so can correspond to several different state
dirs. PASSWD is an optional feature, and not enabled by default; maybe it
should be, but the question of what path to use for it is not obvious. I
suppose it could be changed to default to / or the current chroot directory,
but I don't know that that would help. NOSYMLINKEXP is behavior which may
be desireable or undesireable, and it's really usage-specific. Not sure why
DISABLED=0 is needed here.

In a lot of these cases, there's no meaningful way to make a sane default. I
suppose in theory we could search through LD_LIBRARY_PATH to find a
libpseudo.so and guess PREFIX from that, the other bits are pretty hard to
define good defaults for. Arguably, NOSYMLINKEXP has a sane default, it's
just that this is the use case for which the sane default isn't the right
choice.

And I was thinking a bit about a config file, but that wouldn't really work
for several of these; you don't necessarily want NOSYMLINKEXP shared between
different clients running against the same tree.

-s

Patch

diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
index 302cace..0eb0671 100644
--- a/scripts/lib/mic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
@@ -216,7 +216,14 @@  class Wic_PartData(Mic_PartData):
         """
         Prepare content for an ext2/3/4 rootfs partition.
         """
-        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
+        populate_script = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
+        populate_script += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir
+        populate_script += "export PSEUDO_PASSWD=%s;" % rootfs_dir
+        populate_script += "export PSEUDO_NOSYMLINKEXP=1;"
+        populate_script += "export PSEUDO_DISABLED=0;"
+        populate_script += "%s/usr/bin/pseudo %s/usr/bin/populate-extfs.sh" % \
+            (native_sysroot, native_sysroot)
+
         image_extra_space = 10240
 
         image_rootfs = rootfs_dir