kumquat-buildroot/fs
Yann E. MORIN 4628b6f3b4 fs: add pre- and post-command hooks
In some cases, the directory structure we want in the filesystem is not
exactly what we have in target/

For example, when systemd is used on a read-only rootfs, /var must be a
tmpfs. However, we may have packages that install stuff in there, and
set important rights (via the permission-table). So, at build time, we
need /var to be a symlink to the remanent location (/usr/share/factory)
while at runtime we need /var to be a directory.

One option would have been to have /var as a real directory even during
build time, and in a target-finalize hook, move everything out of there
and into the "factory" location. However, that's not possible because
it's too early: some packages may want to set ownership and/or acces
rights on directories or files in /var, and this is only done in the
fakeroot script, which is called only later during the assembling of the
filesystem images.

Also, there would have been no way to undo the tweak (i.e. we need to
restore the /var symlink so that subsequent builds continue to work) if
it were done as a target-finalize hook.

The only solution is to allow packages to register pre- and post-hooks
that are called right before and right after the rootfs commands are
executed, and inside in the fakeroot script.

We can however not re-use the BR2_ROOTFS_POST_FAKEROOT_SCRIPT feature
either because it is done before the filesystem command, but there is
nothing that is done after. Also, we don't want to add to, and modify a
user-supplied variable.

So, we introduce two new variables that packages can set to add the
commands they need to run to tweak the filesystem right at the last
moment.

Those hooks are not documented on-purpose; they are probably going to
only ever be used by systemd.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-08-02 20:58:27 +02:00
..
axfs Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin 2017-07-05 15:19:29 +02:00
cloop Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin 2017-07-05 15:19:29 +02:00
cpio package: indentation cleanup 2014-10-26 05:47:05 +01:00
cramfs Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin 2017-07-05 15:19:29 +02:00
ext2 fs/ext2: fix typo 2017-07-29 00:46:13 +02:00
initramfs fs: declare phony targets as such 2015-04-14 10:12:32 +02:00
iso9660 Globally replace $(HOST_DIR)/usr/share with $(HOST_DIR)/share 2017-07-05 15:21:31 +02:00
jffs2 fs/jffs2: split commands 2016-06-07 22:21:08 +02:00
romfs Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin 2017-07-05 15:19:29 +02:00
squashfs fs/squashfs: cleanup if-else cascade 2017-07-11 22:33:51 +02:00
tar fs/tar: make --no-recursion effective 2016-12-28 10:13:21 +01:00
ubifs Globally replace $(HOST_DIR)/usr/sbin with $(HOST_DIR)/sbin 2017-07-05 15:19:44 +02:00
yaffs2 Globally replace $(HOST_DIR)/usr/bin with $(HOST_DIR)/bin 2017-07-05 15:19:29 +02:00
common.mk fs: add pre- and post-command hooks 2017-08-02 20:58:27 +02:00
Config.in axfs: add new filesystem type 2015-10-14 23:47:30 +02:00