* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
@ 2013-10-15 13:21 Andrew Ruder
2013-10-15 14:19 ` Thomas Petazzoni
2013-10-27 9:30 ` Arnout Vandecappelle
0 siblings, 2 replies; 7+ messages in thread
From: Andrew Ruder @ 2013-10-15 13:21 UTC (permalink / raw)
To: buildroot
This adds a BR2_ROOTFS_FAKE_ROOT_SCRIPT (similar to
BR2_ROOTFS_POST_BUILD_SCRIPT and BR2_ROOTFS_POST_IMAGE_SCRIPT). This
script is called inside the fakeroot which allows the script to change
permissions, create device nodes, etc.
Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
---
I am using this script as part of a configuration that creates a bunch
of directories that need to have specific ownership. I can create
the directories in a post-build script, but permissions needed to be
done in a fakeroot environment. Didn't see any other way to hook into
the fakeroot.
fs/common.mk | 2 ++
system/Config.in | 16 +++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/fs/common.mk b/fs/common.mk
index 4dab7ea..dfcc647 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -58,6 +58,8 @@ endif
endif
printf '$(subst $(sep),\n,$(PACKAGES_USERS))' > $(USERS_TABLE)
$(TOPDIR)/support/scripts/mkusers $(USERS_TABLE) $(TARGET_DIR) >> $(FAKEROOT_SCRIPT)
+ $$(foreach s, $$(call qstrip,$$(BR2_ROOTFS_FAKE_ROOT_SCRIPT)), \
+ echo $$(s) $$(TARGET_DIR) $$(call qstrip,$$(BR2_ROOTFS_POST_SCRIPT_ARGS)) "|| exit" >> $$(FAKEROOT_SCRIPT)$$(sep))
echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
chmod a+x $$(FAKEROOT_SCRIPT)
$$(HOST_DIR)/usr/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
diff --git a/system/Config.in b/system/Config.in
index 4c80087..ef9c689 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -312,9 +312,23 @@ config BR2_ROOTFS_POST_IMAGE_SCRIPT
first argument. The script is executed from the main Buildroot
source directory as the current directory.
+config BR2_ROOTFS_FAKE_ROOT_SCRIPT
+ string "Custom scripts to run during fakeroot image creation"
+ default ""
+ help
+ Specify a space-separated list of scripts to be run after the build
+ has finished at the end of the fakeroot filesystem image creation.
+
+ This gives a final chance to change permissions, create device
+ nodes, etc.
+
+ These scripts are called with the target directory name as first
+ argument. Make sure the exit code of those scripts are 0, otherwise
+ make will stop after calling them.
+
config BR2_ROOTFS_POST_SCRIPT_ARGS
string "Extra post-{build,image} arguments"
- depends on BR2_ROOTFS_POST_BUILD_SCRIPT != "" || BR2_ROOTFS_POST_IMAGE_SCRIPT != ""
+ depends on BR2_ROOTFS_POST_BUILD_SCRIPT != "" || BR2_ROOTFS_POST_IMAGE_SCRIPT != "" || BR2_ROOTFS_FAKE_ROOT_SCRIPT != ""
help
Pass these aditional arguments to each post-build or post-image
scripts.
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
2013-10-15 13:21 [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script Andrew Ruder
@ 2013-10-15 14:19 ` Thomas Petazzoni
2013-10-18 20:23 ` Andrew Ruder
2013-10-27 9:30 ` Arnout Vandecappelle
1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2013-10-15 14:19 UTC (permalink / raw)
To: buildroot
Dear Andrew Ruder,
On Tue, 15 Oct 2013 08:21:02 -0500, Andrew Ruder wrote:
> This adds a BR2_ROOTFS_FAKE_ROOT_SCRIPT (similar to
Should be FAKEROOT, not FAKE_ROOT (if we validate the whole proposal
this patch is doing).
> BR2_ROOTFS_POST_BUILD_SCRIPT and BR2_ROOTFS_POST_IMAGE_SCRIPT). This
> script is called inside the fakeroot which allows the script to change
> permissions, create device nodes, etc.
>
> Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
> ---
> I am using this script as part of a configuration that creates a bunch
> of directories that need to have specific ownership. I can create
> the directories in a post-build script, but permissions needed to be
> done in a fakeroot environment. Didn't see any other way to hook into
> the fakeroot.
Well, the conventional way would be to have those directories created
by packages (and they can use the <pkg>_PERMISSIONS mechanism to get
proper ownership or permissions). Or, if they really don't belong to
any package, create them in the post build script, and have a device
table assign the permission and ownership.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
2013-10-15 14:19 ` Thomas Petazzoni
@ 2013-10-18 20:23 ` Andrew Ruder
2013-10-18 20:49 ` Yann E. MORIN
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Ruder @ 2013-10-18 20:23 UTC (permalink / raw)
To: buildroot
On Tue, Oct 15, 2013 at 04:19:41PM +0200, Thomas Petazzoni wrote:
> Well, the conventional way would be to have those directories created
> by packages (and they can use the <pkg>_PERMISSIONS mechanism to get
> proper ownership or permissions). Or, if they really don't belong to
> any package, create them in the post build script, and have a device
> table assign the permission and ownership.
I didn't realize the device table functionality could modify arbitrary
file/directory ownerships but looking through the makedevs source code
that DOES appear to be true. I guess let's just consider this thread as
a question disguised as a poorly spelled patch. :)
Cheers,
Andy
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
2013-10-18 20:23 ` Andrew Ruder
@ 2013-10-18 20:49 ` Yann E. MORIN
2013-10-18 21:35 ` Andrew Ruder
0 siblings, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2013-10-18 20:49 UTC (permalink / raw)
To: buildroot
Andrew, All,
On 2013-10-18 15:23 -0500, Andrew Ruder spake thusly:
> On Tue, Oct 15, 2013 at 04:19:41PM +0200, Thomas Petazzoni wrote:
> > Well, the conventional way would be to have those directories created
> > by packages (and they can use the <pkg>_PERMISSIONS mechanism to get
> > proper ownership or permissions). Or, if they really don't belong to
> > any package, create them in the post build script, and have a device
> > table assign the permission and ownership.
>
> I didn't realize the device table functionality could modify arbitrary
> file/directory ownerships but looking through the makedevs source code
> that DOES appear to be true.
Or you could have had a look at the manual:
http://buildroot.net/downloads/manual/manual.html#makedev-syntax
The first sentence in this section reads:
The makedev syntax is used in several places in Buildroot to define
changes to be made for permissions. [...]
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
2013-10-18 20:49 ` Yann E. MORIN
@ 2013-10-18 21:35 ` Andrew Ruder
2013-10-18 22:07 ` Yann E. MORIN
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Ruder @ 2013-10-18 21:35 UTC (permalink / raw)
To: buildroot
On Fri, Oct 18, 2013 at 10:49:20PM +0200, Yann E. MORIN wrote:
> Or you could have had a look at the manual:
> http://buildroot.net/downloads/manual/manual.html#makedev-syntax
>
> The first sentence in this section reads:
Yes, taken out of context it looks perfect, but put the whole sentence
in there and it sounds like it is specifically for device node creation.
> The makedev syntax is used in several places in Buildroot to define
> changes to be made for permissions, or which device files to create
> and how to create them, ***in order to avoid calls to mknod.***
Emphasis mine, of course.
- Andy
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
2013-10-18 21:35 ` Andrew Ruder
@ 2013-10-18 22:07 ` Yann E. MORIN
0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2013-10-18 22:07 UTC (permalink / raw)
To: buildroot
Andrew, All,
On 2013-10-18 16:35 -0500, Andrew Ruder spake thusly:
> On Fri, Oct 18, 2013 at 10:49:20PM +0200, Yann E. MORIN wrote:
> > Or you could have had a look at the manual:
> > http://buildroot.net/downloads/manual/manual.html#makedev-syntax
> >
> > The first sentence in this section reads:
>
> Yes, taken out of context it looks perfect, but put the whole sentence
> in there and it sounds like it is specifically for device node creation.
>
> > The makedev syntax is used in several places in Buildroot to define
> > changes to be made for permissions, or which device files to create
> > and how to create them, ***in order to avoid calls to mknod.***
>
> Emphasis mine, of course.
OK, maybe previous knowledge of the features makes me read the section
in a way that makes it explicit for me. It might not look the same to
others. Then, perhaps you could provide a better wording for this? ;-)
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script
2013-10-15 13:21 [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script Andrew Ruder
2013-10-15 14:19 ` Thomas Petazzoni
@ 2013-10-27 9:30 ` Arnout Vandecappelle
1 sibling, 0 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2013-10-27 9:30 UTC (permalink / raw)
To: buildroot
On 15/10/13 15:21, Andrew Ruder wrote:
> This adds a BR2_ROOTFS_FAKE_ROOT_SCRIPT (similar to
> BR2_ROOTFS_POST_BUILD_SCRIPT and BR2_ROOTFS_POST_IMAGE_SCRIPT). This
> script is called inside the fakeroot which allows the script to change
> permissions, create device nodes, etc.
>
> Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
> ---
> I am using this script as part of a configuration that creates a bunch
> of directories that need to have specific ownership. I can create
> the directories in a post-build script, but permissions needed to be
> done in a fakeroot environment. Didn't see any other way to hook into
> the fakeroot.
Hi Andrew,
At the buildroot developer meeting we decided to drop this patch. For
your particular use case, there is a better way to do it with
<pkg>_PERMISSIONS or with the device table. We also discussed other use
cases, like doing an rsync inside the fakeroot, but these use cases can
just untar the tarball in a post-image script and work on that. And
finally, having all these different POST_xxx steps makes things confusing.
If you still see a reason to add this feature, don't hesitate to tell us.
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] 7+ messages in thread
end of thread, other threads:[~2013-10-27 9:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 13:21 [Buildroot] [RFC PATCH] fs/common.mk: Add support for fakeroot script Andrew Ruder
2013-10-15 14:19 ` Thomas Petazzoni
2013-10-18 20:23 ` Andrew Ruder
2013-10-18 20:49 ` Yann E. MORIN
2013-10-18 21:35 ` Andrew Ruder
2013-10-18 22:07 ` Yann E. MORIN
2013-10-27 9:30 ` Arnout Vandecappelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox