prestart: fixup legacy udev effects

Legacy udev will do a couple of operations that will destroy all the setup we
have done for /dev. This is because, unaware that it is that it is being
containerized, it will mount a tmpfs on /dev, and then setup it all again.
Since preemptively preventing those actions to happen is very hard ( as an
example, centos6 init binary will issue mount syscalls itself), the most robust
approach is to insert a script that will be run shortly after rc.sysinit.

It is hard to detect if rc.sysinit was already ran, but we notice that at the
end of each run (for both versions 4, 5 and 6), it will touch /.autofsck. We
can check if the file was modified (non-existent -> existent, or different
modification time) and run our fixups after this.

[kir@: remove misaligned and obsoleted comments]

Signed-off-by: Glauber Costa <glommer@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed