Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Buildroot "install" wrapper to preserve file permissions
@ 2011-04-05  7:48 Daniel Nyström
  2011-04-05 19:54 ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Nyström @ 2011-04-05  7:48 UTC (permalink / raw)
  To: buildroot

An idea born out of the lately device_table.txt and install issues
discuessed lately.

In other tools similar to Buildroot (e.g. Axis SDK) I've seen an
"install" wrapper which sort of populate an device_table.txt while
installing each component.

In that way, it will preserve any setup, owner and permission on every
file without any global device_table.txt modifications.

(The Axis SDK actually uses meta files in the target dir, but that
would require a whole lot of tool patching while a dynamically written
device_table.txt would work as well)

How would you like this sort of approach in Buildroot?

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-05  7:48 [Buildroot] Buildroot "install" wrapper to preserve file permissions Daniel Nyström
@ 2011-04-05 19:54 ` Thomas Petazzoni
  2011-04-05 19:58   ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2011-04-05 19:54 UTC (permalink / raw)
  To: buildroot

On Tue, 5 Apr 2011 09:48:22 +0200
Daniel Nystr?m <daniel.nystrom@timeterminal.se> wrote:

> An idea born out of the lately device_table.txt and install issues
> discuessed lately.
> 
> In other tools similar to Buildroot (e.g. Axis SDK) I've seen an
> "install" wrapper which sort of populate an device_table.txt while
> installing each component.
> 
> In that way, it will preserve any setup, owner and permission on every
> file without any global device_table.txt modifications.
> 
> (The Axis SDK actually uses meta files in the target dir, but that
> would require a whole lot of tool patching while a dynamically written
> device_table.txt would work as well)
> 
> How would you like this sort of approach in Buildroot?

Yesterday, I've implemented something that allows each package to add
contents to the device table, so that packages can create additional
device files, or adjust the permissions of the files they install. I
needed this to fix the dbus package, which requires a particular
program to have strict permission and ownership properties.

Basically, each package can do:

define <pkg>_PERMISSION_TABLE
some content exactly similar to a device table fragment
endef

and it will automatically be appended to the device table if the
package is enabled.

Would that match your needs ?

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-05 19:54 ` Thomas Petazzoni
@ 2011-04-05 19:58   ` Peter Korsgaard
  2011-04-05 20:32     ` Daniel Nyström
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2011-04-05 19:58 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 >> How would you like this sort of approach in Buildroot?

 Thomas> Yesterday, I've implemented something that allows each package to add
 Thomas> contents to the device table, so that packages can create additional
 Thomas> device files, or adjust the permissions of the files they install. I
 Thomas> needed this to fix the dbus package, which requires a particular
 Thomas> program to have strict permission and ownership properties.

 Thomas> Basically, each package can do:

 Thomas> define <pkg>_PERMISSION_TABLE
 Thomas> some content exactly similar to a device table fragment
 Thomas> endef

 Thomas> and it will automatically be appended to the device table if the
 Thomas> package is enabled.

 Thomas> Would that match your needs ?

I think Daniel's proposal is to use a custom install program (wrapper),
which would then automatically create those device_table.txt snippets.

I like the idea.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-05 19:58   ` Peter Korsgaard
@ 2011-04-05 20:32     ` Daniel Nyström
  2011-04-05 21:42       ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Nyström @ 2011-04-05 20:32 UTC (permalink / raw)
  To: buildroot

2011/4/5 Peter Korsgaard <jacmet@uclibc.org>:
> I think Daniel's proposal is to use a custom install program (wrapper),
> which would then automatically create those device_table.txt snippets.

Yes, that's how I meant. Sorry for any bad description.

I thing this would also make many packages installed by e.g. autoconf
preserve their permissions without any extra code.

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-05 20:32     ` Daniel Nyström
@ 2011-04-05 21:42       ` Thomas Petazzoni
  2011-04-05 22:00         ` Daniel Nyström
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2011-04-05 21:42 UTC (permalink / raw)
  To: buildroot

On Tue, 5 Apr 2011 22:32:52 +0200
Daniel Nystr?m <daniel.nystrom@timeterminal.se> wrote:

> Yes, that's how I meant. Sorry for any bad description.
> 
> I thing this would also make many packages installed by e.g. autoconf
> preserve their permissions without any extra code.

How does this wrapper works ? I'd like to check if it solve my dbus
issue, because I'm not sure that the dbus build system installs it with
the correct ownership (permission will probably be correct, but I'm not
sure about ownership).

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-05 21:42       ` Thomas Petazzoni
@ 2011-04-05 22:00         ` Daniel Nyström
  2011-04-06  6:59           ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Nyström @ 2011-04-05 22:00 UTC (permalink / raw)
  To: buildroot

2011/4/5 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:
> On Tue, 5 Apr 2011 22:32:52 +0200
> Daniel Nystr?m <daniel.nystrom@timeterminal.se> wrote:
>
>> Yes, that's how I meant. Sorry for any bad description.
>>
>> I thing this would also make many packages installed by e.g. autoconf
>> preserve their permissions without any extra code.
>
> How does this wrapper works ? I'd like to check if it solve my dbus
> issue, because I'm not sure that the dbus build system installs it with
> the correct ownership (permission will probably be correct, but I'm not
> sure about ownership).

There is none yet, but as I think of it, it just adds a line in the
device_table.txt with the path and permission to the installed files.

install -o 1000 -g 1000 -m 755 mybinary /usr/bin/mybinary

("install" is actually the wrapper) would put a line like this in
device_table.txt:

/usr/bin/mybinary  f  755 1000 1000 - - - - -

Not very familiar with device_table.txt syntax, but you get the idea.

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-05 22:00         ` Daniel Nyström
@ 2011-04-06  6:59           ` Peter Korsgaard
  2011-04-06  7:32             ` Daniel Nyström
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2011-04-06  6:59 UTC (permalink / raw)
  To: buildroot

>>>>> "Daniel" == Daniel Nystr?m <daniel.nystrom@timeterminal.se> writes:

Hi,

 >> How does this wrapper works ? I'd like to check if it solve my dbus
 >> issue, because I'm not sure that the dbus build system installs it with
 >> the correct ownership (permission will probably be correct, but I'm not
 >> sure about ownership).

 Daniel> There is none yet, but as I think of it, it just adds a line in the
 Daniel> device_table.txt with the path and permission to the installed files.

 Daniel> install -o 1000 -g 1000 -m 755 mybinary /usr/bin/mybinary

Something like that, except it should only do so when called with a
destination directory under $(TARGET_DIR) and only if called with -o or
-g to set owner/group differently than root/root. As a further
complication owner/group can be numeric or names, and names have to get
resolved to the IDs we have in $(TARGET_DIR)/etc/{passwd,group}.

Finally the -o / -g options should get stripped and the request
forwarded to the real install program.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] Buildroot "install" wrapper to preserve file permissions
  2011-04-06  6:59           ` Peter Korsgaard
@ 2011-04-06  7:32             ` Daniel Nyström
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Nyström @ 2011-04-06  7:32 UTC (permalink / raw)
  To: buildroot

Den 6 april 2011 08:59 skrev Peter Korsgaard <jacmet@uclibc.org>:
> ?>> How does this wrapper works ? I'd like to check if it solve my dbus
> ?>> issue, because I'm not sure that the dbus build system installs it with
> ?>> the correct ownership (permission will probably be correct, but I'm not
> ?>> sure about ownership).
>
> ?Daniel> There is none yet, but as I think of it, it just adds a line in the
> ?Daniel> device_table.txt with the path and permission to the installed files.
>
> ?Daniel> install -o 1000 -g 1000 -m 755 mybinary /usr/bin/mybinary
>
> Something like that, except it should only do so when called with a
> destination directory under $(TARGET_DIR) and only if called with -o or
> -g to set owner/group differently than root/root. As a further
> complication owner/group can be numeric or names, and names have to get
> resolved to the IDs we have in $(TARGET_DIR)/etc/{passwd,group}.
>
> Finally the -o / -g options should get stripped and the request
> forwarded to the real install program.

Thanks for elaborating!

Is there any permissions not allowed to be set by the user? If that's
the case, one could strip -m as well. That would also prevent
execution of target binaries on host system (if that's the case
nowadays? I'm on an old Buildroot version myself).

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

end of thread, other threads:[~2011-04-06  7:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05  7:48 [Buildroot] Buildroot "install" wrapper to preserve file permissions Daniel Nyström
2011-04-05 19:54 ` Thomas Petazzoni
2011-04-05 19:58   ` Peter Korsgaard
2011-04-05 20:32     ` Daniel Nyström
2011-04-05 21:42       ` Thomas Petazzoni
2011-04-05 22:00         ` Daniel Nyström
2011-04-06  6:59           ` Peter Korsgaard
2011-04-06  7:32             ` Daniel Nyström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox