[yocto] preserving file owners in do_package
Davide Soldan
davide.soldan at kynetics.it
Fri Oct 18 06:31:22 PDT 2013
In data martedì 15 ottobre 2013 17:18:35, Paul Eggleton ha scritto:
> On Tuesday 15 October 2013 18:12:42 Davide Soldan wrote:
> > In data martedì 15 ottobre 2013 11:38:21, Paul Eggleton ha scritto:
> > > On Tuesday 15 October 2013 12:02:20 Davide Soldan wrote:
> > > > in my recipe I want to change owner and permission of a file, so I
> > > > wrote:
> > > >
> > > > do_install() {
> > > >
> > > > ls -la ${D}/opt/user
> > > > chown -R user ${D}/opt/user
> > > > chgrp -R user ${D}/opt/user
> > > > ls -la ${D}/opt/user
> > > > chmod 754 ${D}/opt/user/user.sh
> > > > ls -la ${D}/opt/user
> > > >
> > > > }
> > > >
> > > > the output of ls commands is:
> > > >
> > > > drwxr-xr-x 8 root root 4096 Oct 15 11:13 .
> > > > drwxr-xr-x 3 root root 4096 Oct 15 11:13 ..
> > > > -rw-r--r-- 1 *root root* 55753 Aug 2 08:48 user.sh
> > > >
> > > > drwxr-xr-x 8 user user 4096 Oct 15 11:13 .
> > > > drwxr-xr-x 3 root root 4096 Oct 15 11:13 ..
> > > > -rw-r--r-- 1 *user user* 55753 Aug 2 08:48 user.sh
> > > >
> > > > drwxr-xr-x 8 user user 4096 Oct 15 11:13 .
> > > > drwxr-xr-x 3 root root 4096 Oct 15 11:13 ..
> > > > *-rwxr-xr--* 1 user user 55753 Aug 2 08:48 user.sh
> > > >
> > > > So the change of owner and permission works fine in do_install phase.
> > > > Opening the final rootfs tarball, however, the file user.sh has still
> > > > 754
> > > > permission but root as owner...so do_package doesn't preserve owner
> > > > change
> > > > done in do_install? Or maybe I'm doing something wrong in changing file
> > > > owner? Any ideas? Thanks to all!
> > >
> > > Does your recipe create the specified user via useradd.bbclass?
> >
> > I solved with a postinstall script (that run at boot):
> >
> > pkg_postinst_${PN}() {
> > #!/bin/sh -e
> > if [ x"$D" = "x" ]; then
> > chown -R user /opt/user
> > chgrp -R user /opt/user
> > else
> > exit 1
> > fi
> > }
>
> This shouldn't be necessary though. I honestly can't tell you why it doesn't
> work as specified. I think it might be worth filing a bug for this.
>
> Cheers,
> Paul
>
>
I'm so sorry Paul, but my mail client missed your last email and so I filed a bug uselessly...
I tried, as you suggested, to add the package that create the user to the RDEPENDS_${PN} removing the postinstall scripi. That worked setting the right owner with chown/chgrp in do_install...
Thank you so much. I very sorry for the useless bug opened...can I close it by myself?
Cheers
Davide
More information about the yocto
mailing list