Attempt to modify Gentoo-baselayout to make vserver-deployment easier without breaking the current behaviour and without needing to split the baselayout.

The modifications outlined below were tested with sys-apps/baselayout-1.9.4-r2 on a vserver-enabled system without trouble; further testing is needed as failures in baselayout may render the system unbootable.

sources of information:

related Gentoo-packages:

helper-functions and modification of /sbin/rc and /etc/inittab

modify initscripts

We need to modify some initscripts as some operations are not possible within a vserver and the dependency-tracking of the Gentoo-initsystem is more than unhappy with failing services (which is the perfectly correct behaviour).

A vserver "inherits" some of the root-server setup or get's configured from the root-server. This is the case for, e.g. hardware-clock and network-configuration.

List of initscripts that we need to make vserver-aware:

hostname
modules
checkfs
localmount
clock
consolefont
serial
net.eth0
net.lo

We use the same trick as in /sbin/rc, each initscript gets the following lines added at the top (directly after the copyright-header):

## vserver-support:
[ -f /sbin/vserver-functions.sh ] && source /sbin/vserver-functions.sh
on_vserver && exit 0
(if this get's integrated in the offical baselayout the sourcing of vserver-functions.sh will happen at a more central place and not in every initscript)

reboot and halt

In order to enable reboot and halt for a vserver rebootmgr needs to be running on the root-server and /sbin/halt on the vserver needs to be replaced by vreboot from sys-cluster/util-vserver. (what about /etc/init.d/shutdown.sh?)

Simply overwriting it is not a good solution as the next baselayout-update will revert to the "wrong" (non-vserver) version.
If we only modify /etc/init.d/halt.sh and /etc/init.d/reboot.sh like

sed -i -e "s@/sbin/halt@/sbin/vhalt@g;" /etc/init.d/halt.sh
	:
	:

it is still possible to type reboot on the shell-prompt and loose contact with your vserver.

=> we need to decide what way to go here (maybe a vserver-USE-flag for baselayout could be introduced?).