All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Changing permission recursively
@ 2015-03-12  9:08 Angelo Compagnucci
  2015-03-12 12:41 ` Matthew Weber
  2015-03-12 17:55 ` Baruch Siach
  0 siblings, 2 replies; 12+ messages in thread
From: Angelo Compagnucci @ 2015-03-12  9:08 UTC (permalink / raw)
  To: buildroot

Deal All,

I'm in the process of building a rootfs for a custom application and
wondering the best way to change permissions recursively for a
directory.

What I'm trying to achieve is to add some files via an overlay, but
files should have a specific owner/permission which should be read
from the buildroot's users table.

I cannot find something like that in the documentation. Instead, the
documentation specifies how to add single files and change
owner/permission accordingly.

If I understand correctly, I should create a new user (if necessary)
with a specific UDI/GID and than use a POST_INSTALL_TARGET to change
permission using that UID/GID.
Alternatively, I can use FOO_PERMISSIONS with a per file granularity.

Is this correct?

Thanks!

Sincerely, Angelo

-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

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

* [Buildroot] Changing permission recursively
  2015-03-12  9:08 [Buildroot] Changing permission recursively Angelo Compagnucci
@ 2015-03-12 12:41 ` Matthew Weber
  2015-03-12 13:53   ` Angelo Compagnucci
  2015-03-12 17:55 ` Baruch Siach
  1 sibling, 1 reply; 12+ messages in thread
From: Matthew Weber @ 2015-03-12 12:41 UTC (permalink / raw)
  To: buildroot

Angelo,

On Thu, Mar 12, 2015 at 4:08 AM, Angelo Compagnucci <
angelo.compagnucci@gmail.com> wrote:

> Deal All,
>
> I'm in the process of building a rootfs for a custom application and
> wondering the best way to change permissions recursively for a
> directory.
>
> What I'm trying to achieve is to add some files via an overlay, but
> files should have a specific owner/permission which should be read
> from the buildroot's users table.
>
> I cannot find something like that in the documentation. Instead, the
> documentation specifies how to add single files and change
> owner/permission accordingly.
>

I assume you've looked at building the a permissions table file which you
would add to your "System configuration -> Path to the permission tables"
config option (which uses makedev to apply the correc uid/gid and
permissions to files/folders).  However I do believe it requires you to
itemize out all items like you've mentioned.
(http://buildroot.uclibc.org/downloads/manual/manual.html#makedev-syntax)

Matt


> If I understand correctly, I should create a new user (if necessary)
> with a specific UDI/GID and than use a POST_INSTALL_TARGET to change
> permission using that UID/GID.
> Alternatively, I can use FOO_PERMISSIONS with a per file granularity.
>
> Is this correct?
>
> Thanks!
>
> Sincerely, Angelo
>
> --
> Profile: http://it.linkedin.com/in/compagnucciangelo
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150312/c2f6abc8/attachment.html>

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

* [Buildroot] Changing permission recursively
  2015-03-12 12:41 ` Matthew Weber
@ 2015-03-12 13:53   ` Angelo Compagnucci
  0 siblings, 0 replies; 12+ messages in thread
From: Angelo Compagnucci @ 2015-03-12 13:53 UTC (permalink / raw)
  To: buildroot

Dear Matthew Weber,

2015-03-12 13:41 GMT+01:00 Matthew Weber <matthew.weber@rockwellcollins.com>:
> Angelo,
>
> On Thu, Mar 12, 2015 at 4:08 AM, Angelo Compagnucci
> <angelo.compagnucci@gmail.com> wrote:
>>
>> Deal All,
>>
>> I'm in the process of building a rootfs for a custom application and
>> wondering the best way to change permissions recursively for a
>> directory.
>>
>> What I'm trying to achieve is to add some files via an overlay, but
>> files should have a specific owner/permission which should be read
>> from the buildroot's users table.
>>
>> I cannot find something like that in the documentation. Instead, the
>> documentation specifies how to add single files and change
>> owner/permission accordingly.
>
>
> I assume you've looked at building the a permissions table file which you
> would add to your "System configuration -> Path to the permission tables"
> config option (which uses makedev to apply the correc uid/gid and
> permissions to files/folders).  However I do believe it requires you to
> itemize out all items like you've mentioned.
> (http://buildroot.uclibc.org/downloads/manual/manual.html#makedev-syntax)
>
> Matt
>
>>
>> If I understand correctly, I should create a new user (if necessary)
>> with a specific UDI/GID and than use a POST_INSTALL_TARGET to change
>> permission using that UID/GID.
>> Alternatively, I can use FOO_PERMISSIONS with a per file granularity.
>>
>> Is this correct?

As I stated previously, I looked into FOO_PERMISSIONS that shares the
very same makedev syntax, and from my understanding, you should handle
files one by one.

I'm looking for changing permission recursively, without the effort to
itemize each file.

>>
>> Thanks!
>>
>> Sincerely, Angelo
>>
>> --
>> Profile: http://it.linkedin.com/in/compagnucciangelo
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
>
>



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

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

* [Buildroot] Changing permission recursively
  2015-03-12  9:08 [Buildroot] Changing permission recursively Angelo Compagnucci
  2015-03-12 12:41 ` Matthew Weber
@ 2015-03-12 17:55 ` Baruch Siach
  2015-03-12 20:32   ` Arnout Vandecappelle
  2015-03-13  6:31   ` Thomas Petazzoni
  1 sibling, 2 replies; 12+ messages in thread
From: Baruch Siach @ 2015-03-12 17:55 UTC (permalink / raw)
  To: buildroot

Hi Angelo,

On Thu, Mar 12, 2015 at 10:08:10AM +0100, Angelo Compagnucci wrote:
> I'm in the process of building a rootfs for a custom application and
> wondering the best way to change permissions recursively for a
> directory.
> 
> What I'm trying to achieve is to add some files via an overlay, but
> files should have a specific owner/permission which should be read
> from the buildroot's users table.
> 
> I cannot find something like that in the documentation. Instead, the
> documentation specifies how to add single files and change
> owner/permission accordingly.
> 
> If I understand correctly, I should create a new user (if necessary)
> with a specific UDI/GID and than use a POST_INSTALL_TARGET to change
> permission using that UID/GID.
> Alternatively, I can use FOO_PERMISSIONS with a per file granularity.
> 
> Is this correct?

How about running the following from a post build script (untested):

	${HOST_DIR}/usr/bin/fakeroot -- chown -R UID:GID ${1}/path/to/directory

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* [Buildroot] Changing permission recursively
  2015-03-12 17:55 ` Baruch Siach
@ 2015-03-12 20:32   ` Arnout Vandecappelle
  2015-03-13  6:32     ` Thomas Petazzoni
  2015-03-13  6:31   ` Thomas Petazzoni
  1 sibling, 1 reply; 12+ messages in thread
From: Arnout Vandecappelle @ 2015-03-12 20:32 UTC (permalink / raw)
  To: buildroot

On 12/03/15 18:55, Baruch Siach wrote:
> Hi Angelo,
> 
> On Thu, Mar 12, 2015 at 10:08:10AM +0100, Angelo Compagnucci wrote:
>> I'm in the process of building a rootfs for a custom application and
>> wondering the best way to change permissions recursively for a
>> directory.
>>
>> What I'm trying to achieve is to add some files via an overlay, but
>> files should have a specific owner/permission which should be read
>> from the buildroot's users table.
>>
>> I cannot find something like that in the documentation. Instead, the
>> documentation specifies how to add single files and change
>> owner/permission accordingly.
>>
>> If I understand correctly, I should create a new user (if necessary)
>> with a specific UDI/GID and than use a POST_INSTALL_TARGET to change
>> permission using that UID/GID.
>> Alternatively, I can use FOO_PERMISSIONS with a per file granularity.
>>
>> Is this correct?
> 
> How about running the following from a post build script (untested):
> 
> 	${HOST_DIR}/usr/bin/fakeroot -- chown -R UID:GID ${1}/path/to/directory
> 
> baruch
> 

 I think it would be easier to extend package/makedevs/makedevs.c to support
recursive operation.


 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] Changing permission recursively
  2015-03-12 17:55 ` Baruch Siach
  2015-03-12 20:32   ` Arnout Vandecappelle
@ 2015-03-13  6:31   ` Thomas Petazzoni
  2015-03-13  6:46     ` Angelo Compagnucci
  1 sibling, 1 reply; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-13  6:31 UTC (permalink / raw)
  To: buildroot

Dear Baruch Siach,

On Thu, 12 Mar 2015 19:55:28 +0200, Baruch Siach wrote:

> How about running the following from a post build script (untested):
> 
> 	${HOST_DIR}/usr/bin/fakeroot -- chown -R UID:GID ${1}/path/to/directory

Does this actually works ?

My understanding of fakeroot is that you have to execute all the
fakeroot'ed commands under the same fakeroot invocation for the changes
made by these commands to actually have an effect.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] Changing permission recursively
  2015-03-12 20:32   ` Arnout Vandecappelle
@ 2015-03-13  6:32     ` Thomas Petazzoni
  2015-03-13  6:40       ` Angelo Compagnucci
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-13  6:32 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle,

On Thu, 12 Mar 2015 21:32:00 +0100, Arnout Vandecappelle wrote:

>  I think it would be easier to extend package/makedevs/makedevs.c to support
> recursive operation.

Yes, I agree. It seems quite usual to need an entire subtree with a
certain set of ownership/permissions.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] Changing permission recursively
  2015-03-13  6:32     ` Thomas Petazzoni
@ 2015-03-13  6:40       ` Angelo Compagnucci
  0 siblings, 0 replies; 12+ messages in thread
From: Angelo Compagnucci @ 2015-03-13  6:40 UTC (permalink / raw)
  To: buildroot

Dear Thomas Petazzoni,

2015-03-13 7:32 GMT+01:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Dear Arnout Vandecappelle,
>
> On Thu, 12 Mar 2015 21:32:00 +0100, Arnout Vandecappelle wrote:
>
>>  I think it would be easier to extend package/makedevs/makedevs.c to support
>> recursive operation.
>
> Yes, I agree. It seems quite usual to need an entire subtree with a
> certain set of ownership/permissions.

I have already an almost working patch, I'll try to submit something
later today.

Sincerely, Angelo

>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

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

* [Buildroot] Changing permission recursively
  2015-03-13  6:31   ` Thomas Petazzoni
@ 2015-03-13  6:46     ` Angelo Compagnucci
  2015-03-13 10:27       ` Baruch Siach
  0 siblings, 1 reply; 12+ messages in thread
From: Angelo Compagnucci @ 2015-03-13  6:46 UTC (permalink / raw)
  To: buildroot

Dear Thomas Petazzoni,

2015-03-13 7:31 GMT+01:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Dear Baruch Siach,
>
> On Thu, 12 Mar 2015 19:55:28 +0200, Baruch Siach wrote:
>
>> How about running the following from a post build script (untested):
>>
>>       ${HOST_DIR}/usr/bin/fakeroot -- chown -R UID:GID ${1}/path/to/directory
>
> Does this actually works ?
>
> My understanding of fakeroot is that you have to execute all the
> fakeroot'ed commands under the same fakeroot invocation for the changes
> made by these commands to actually have an effect.

Fakeroot environment is not kept between invocations. You should use
-i and -s options of fakeroot command if you want to save/restore
permissions between invocations.
We should provide a path for the savefile in buildroot to handle this
scenario, but from my trials, maintaining consistent such file file is
quite challenging.

Sincerely, Angelo

>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

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

* [Buildroot] Changing permission recursively
  2015-03-13  6:46     ` Angelo Compagnucci
@ 2015-03-13 10:27       ` Baruch Siach
  2015-03-13 10:53         ` Thomas Petazzoni
  0 siblings, 1 reply; 12+ messages in thread
From: Baruch Siach @ 2015-03-13 10:27 UTC (permalink / raw)
  To: buildroot

Hi Thomas, Angelo,

On Fri, Mar 13, 2015 at 07:46:03AM +0100, Angelo Compagnucci wrote:
> 2015-03-13 7:31 GMT+01:00 Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com>:
> > On Thu, 12 Mar 2015 19:55:28 +0200, Baruch Siach wrote:
> >
> >> How about running the following from a post build script (untested):
> >>
> >>       ${HOST_DIR}/usr/bin/fakeroot -- chown -R UID:GID ${1}/path/to/directory
> >
> > Does this actually works ?
> >
> > My understanding of fakeroot is that you have to execute all the
> > fakeroot'ed commands under the same fakeroot invocation for the changes
> > made by these commands to actually have an effect.

Right. I forgot that.

> Fakeroot environment is not kept between invocations. You should use
> -i and -s options of fakeroot command if you want to save/restore
> permissions between invocations.
> We should provide a path for the savefile in buildroot to handle this
> scenario, but from my trials, maintaining consistent such file file is
> quite challenging.

Another options is to simply cat a user provided script into 
$(FAKEROOT_SCRIPT) as part of the rootfs image generation at fs/common.mk.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* [Buildroot] Changing permission recursively
  2015-03-13 10:27       ` Baruch Siach
@ 2015-03-13 10:53         ` Thomas Petazzoni
  2015-03-13 10:59           ` Angelo Compagnucci
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Petazzoni @ 2015-03-13 10:53 UTC (permalink / raw)
  To: buildroot

Dear Baruch Siach,

On Fri, 13 Mar 2015 12:27:41 +0200, Baruch Siach wrote:

> Another options is to simply cat a user provided script into 
> $(FAKEROOT_SCRIPT) as part of the rootfs image generation at fs/common.mk.

Yes, this is something that has been proposed in the past.

Back then I think our thinking was: maybe it's a bit complicated for
normal users to understand the details of the fakeroot thing, and what
they should put in the custom fakeroot scripts vs. normal post-build
scripts.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] Changing permission recursively
  2015-03-13 10:53         ` Thomas Petazzoni
@ 2015-03-13 10:59           ` Angelo Compagnucci
  0 siblings, 0 replies; 12+ messages in thread
From: Angelo Compagnucci @ 2015-03-13 10:59 UTC (permalink / raw)
  To: buildroot

Dear Thomas Petazzoni,

2015-03-13 11:53 GMT+01:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> Dear Baruch Siach,
>
> On Fri, 13 Mar 2015 12:27:41 +0200, Baruch Siach wrote:
>
>> Another options is to simply cat a user provided script into
>> $(FAKEROOT_SCRIPT) as part of the rootfs image generation at fs/common.mk.
>
> Yes, this is something that has been proposed in the past.
>
> Back then I think our thinking was: maybe it's a bit complicated for
> normal users to understand the details of the fakeroot thing, and what
> they should put in the custom fakeroot scripts vs. normal post-build
> scripts.

I just proposed my own vision on the problem solution!

Sincerely, Angelo

>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

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

end of thread, other threads:[~2015-03-13 10:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12  9:08 [Buildroot] Changing permission recursively Angelo Compagnucci
2015-03-12 12:41 ` Matthew Weber
2015-03-12 13:53   ` Angelo Compagnucci
2015-03-12 17:55 ` Baruch Siach
2015-03-12 20:32   ` Arnout Vandecappelle
2015-03-13  6:32     ` Thomas Petazzoni
2015-03-13  6:40       ` Angelo Compagnucci
2015-03-13  6:31   ` Thomas Petazzoni
2015-03-13  6:46     ` Angelo Compagnucci
2015-03-13 10:27       ` Baruch Siach
2015-03-13 10:53         ` Thomas Petazzoni
2015-03-13 10:59           ` Angelo Compagnucci

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.