All of lore.kernel.org
 help / color / mirror / Atom feed
* preserving file owners in do_package
@ 2013-10-15 10:02 Davide Soldan
  2013-10-15 10:38 ` Paul Eggleton
  0 siblings, 1 reply; 9+ messages in thread
From: Davide Soldan @ 2013-10-15 10:02 UTC (permalink / raw)
  To: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]

Hi to all,
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!

[-- Attachment #2: Type: text/html, Size: 5751 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-15 10:02 preserving file owners in do_package Davide Soldan
@ 2013-10-15 10:38 ` Paul Eggleton
  2013-10-15 10:50   ` Davide Soldan
  2013-10-15 16:12   ` Davide Soldan
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Eggleton @ 2013-10-15 10:38 UTC (permalink / raw)
  To: Davide Soldan; +Cc: yocto

Hi Davide,

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?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-15 10:38 ` Paul Eggleton
@ 2013-10-15 10:50   ` Davide Soldan
  2013-10-15 16:12   ` Davide Soldan
  1 sibling, 0 replies; 9+ messages in thread
From: Davide Soldan @ 2013-10-15 10:50 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

In data martedì 15 ottobre 2013 11:38:21, Paul Eggleton ha scritto:
> Hi Davide,
> 
> 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?
> 
> Cheers,
> Paul
> 
> 
Hi Paul,
I've got a useradd recipe (myuseradd.bbclass) that create that specific user. Also in my recipe I've got the
DEPENDS = "myuseradd"
to be sure that the specific user is created before my recipe is processed.
Within myuseradd recipe I've got some chown command that works fine, but outside that recipe I've got the problem stated in the previous mail...

Davide


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-15 10:38 ` Paul Eggleton
  2013-10-15 10:50   ` Davide Soldan
@ 2013-10-15 16:12   ` Davide Soldan
  2013-10-15 16:18     ` Paul Eggleton
  1 sibling, 1 reply; 9+ messages in thread
From: Davide Soldan @ 2013-10-15 16:12 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

In data martedì 15 ottobre 2013 11:38:21, Paul Eggleton ha scritto:
> Hi Davide,
> 
> 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?
> 
> Cheers,
> Paul
> 
> 
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
}

Cheers
Davide


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-15 16:12   ` Davide Soldan
@ 2013-10-15 16:18     ` Paul Eggleton
  2013-10-15 21:54       ` Paul Eggleton
  2013-10-18 13:31       ` Davide Soldan
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Eggleton @ 2013-10-15 16:18 UTC (permalink / raw)
  To: Davide Soldan; +Cc: yocto

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

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-15 16:18     ` Paul Eggleton
@ 2013-10-15 21:54       ` Paul Eggleton
  2013-10-18 13:31       ` Davide Soldan
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Eggleton @ 2013-10-15 21:54 UTC (permalink / raw)
  To: Davide Soldan; +Cc: yocto

On Tuesday 15 October 2013 17:18:35 Paul Eggleton wrote:
> 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.

Actually, thinking about it I don't think this is expected to work. Typically, 
recipes that need a specific user to exist use useradd.bbclass themselves 
rather than depending upon another recipe that does it. However, if you do 
need to do it in a separate recipe (e.g. because multiple recipes use the same 
user account), just adding the other recipe to DEPENDS does not guarantee that 
it will be around at runtime - the actual package generated by the other 
recipe (usually the same name) would need to be added to RDEPENDS_${PN}. 
Additionally, if you do this, you should be able to have your postinstall 
script run at all times; it should not need to be guarded to run only on the 
target (although https://bugzilla.yoctoproject.org/show_bug.cgi?id=5318 may 
interfere with this if you are using ipk or deb.)

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-15 16:18     ` Paul Eggleton
  2013-10-15 21:54       ` Paul Eggleton
@ 2013-10-18 13:31       ` Davide Soldan
  2013-10-18 13:38         ` Paul Eggleton
  1 sibling, 1 reply; 9+ messages in thread
From: Davide Soldan @ 2013-10-18 13:31 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-18 13:31       ` Davide Soldan
@ 2013-10-18 13:38         ` Paul Eggleton
  2013-10-18 13:57           ` Davide Soldan
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Eggleton @ 2013-10-18 13:38 UTC (permalink / raw)
  To: Davide Soldan; +Cc: yocto

Hi Davide,

On Friday 18 October 2013 15:31:22 Davide Soldan wrote:
> 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?

I've marked it resolved. No problem about filing it, at least it's now there 
for reference if anyone hits the same situation :)

I think it's fair to say we need to look at how to better document all of this 
stuff in the manual. We could probably afford to dedicate a small section on how 
to deal with adding/modifying users and file ownership. Scott, could you add 
this to your todo list?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: preserving file owners in do_package
  2013-10-18 13:38         ` Paul Eggleton
@ 2013-10-18 13:57           ` Davide Soldan
  0 siblings, 0 replies; 9+ messages in thread
From: Davide Soldan @ 2013-10-18 13:57 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

In data venerdì 18 ottobre 2013 14:38:27, Paul Eggleton ha scritto:
> Hi Davide,
> 
> On Friday 18 October 2013 15:31:22 Davide Soldan wrote:
> > 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?
> 
> I've marked it resolved. No problem about filing it, at least it's now there 
> for reference if anyone hits the same situation :)
> 
> I think it's fair to say we need to look at how to better document all of this 
> stuff in the manual. We could probably afford to dedicate a small section on how 
> to deal with adding/modifying users and file ownership. Scott, could you add 
> this to your todo list?
> 
> Cheers,
> Paul
> 
> 
Very good idea! When I was looking for information about how to add/modify users and file ownership I missed a bit of official documentation!
Cheers
Davide


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-10-18 13:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 10:02 preserving file owners in do_package Davide Soldan
2013-10-15 10:38 ` Paul Eggleton
2013-10-15 10:50   ` Davide Soldan
2013-10-15 16:12   ` Davide Soldan
2013-10-15 16:18     ` Paul Eggleton
2013-10-15 21:54       ` Paul Eggleton
2013-10-18 13:31       ` Davide Soldan
2013-10-18 13:38         ` Paul Eggleton
2013-10-18 13:57           ` Davide Soldan

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.