diff -Nur rc-scripts-1.6.9/init.d/clock rc-scripts-1.6.9-vserver/init.d/clock --- rc-scripts-1.6.9/init.d/clock 2005-01-30 22:23:10.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/clock 2005-02-05 11:19:02.997824656 +0100 @@ -3,6 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/clock,v 1.24.2.1 2005/01/30 21:23:10 vapier Exp $ +## vserver incompatible +is_vserver_guest && exit 0 + opts="${opts} save" depend() { diff -Nur rc-scripts-1.6.9/init.d/consolefont rc-scripts-1.6.9-vserver/init.d/consolefont --- rc-scripts-1.6.9/init.d/consolefont 2005-01-30 23:17:37.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/consolefont 2005-02-05 11:19:02.998824504 +0100 @@ -3,6 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/consolefont,v 1.26.4.1 2005/01/30 22:17:37 vapier Exp $ +## vserver incompatible +is_vserver_guest && exit 0 + depend() { need localmount need keymaps # sets up terminal encoding scheme diff -Nur rc-scripts-1.6.9/init.d/halt.sh rc-scripts-1.6.9-vserver/init.d/halt.sh --- rc-scripts-1.6.9/init.d/halt.sh 2005-01-30 23:01:18.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/halt.sh 2005-02-05 11:19:02.999824352 +0100 @@ -2,6 +2,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/halt.sh,v 1.64.2.3 2005/01/30 22:01:18 vapier Exp $ +## vserver incompatible +is_vserver_guest && exit 0 + # Check to see if this is a livecd, if it is read the commandline # this mainly makes sure $CDBOOT is defined if it's a livecd [ -f "/sbin/livecd-functions.sh" ] && \ diff -Nur rc-scripts-1.6.9/init.d/localmount rc-scripts-1.6.9-vserver/init.d/localmount --- rc-scripts-1.6.9/init.d/localmount 2005-01-30 23:01:18.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/localmount 2005-02-05 11:19:03.000824200 +0100 @@ -3,6 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/localmount,v 1.29.4.1 2005/01/30 22:01:18 vapier Exp $ +## vserver incompatible +is_vserver_guest && exit 0 + depend() { need checkfs } diff -Nur rc-scripts-1.6.9/init.d/modules rc-scripts-1.6.9-vserver/init.d/modules --- rc-scripts-1.6.9/init.d/modules 2005-01-30 23:17:37.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/modules 2005-02-05 11:19:03.001824048 +0100 @@ -3,6 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/modules,v 1.32.4.1 2005/01/30 22:17:37 vapier Exp $ +## vserver incompatible +is_vserver_guest && exit 0 + depend() { need checkroot hostname use isapnp diff -Nur rc-scripts-1.6.9/init.d/net.lo rc-scripts-1.6.9-vserver/init.d/net.lo --- rc-scripts-1.6.9/init.d/net.lo 2005-01-30 20:02:06.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/net.lo 2005-02-05 11:19:03.002823896 +0100 @@ -7,6 +7,9 @@ # Many thanks to Aron Griffis (agriffis@gentoo.org) # for help, ideas and patches +## vserver incompatible +is_vserver_guest && exit 0 + #NB: Config is in /etc/conf.d/net if [[ -n ${NET_DEBUG} ]]; then diff -Nur rc-scripts-1.6.9/init.d/serial rc-scripts-1.6.9-vserver/init.d/serial --- rc-scripts-1.6.9/init.d/serial 2005-01-30 23:17:37.000000000 +0100 +++ rc-scripts-1.6.9-vserver/init.d/serial 2005-02-05 11:19:03.003823744 +0100 @@ -3,6 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/serial,v 1.12.4.1 2005/01/30 22:17:37 vapier Exp $ +## vserver incompatible +is_vserver_guest && exit 0 + depend() { need localmount } diff -Nur rc-scripts-1.6.9/sbin/functions.sh rc-scripts-1.6.9-vserver/sbin/functions.sh --- rc-scripts-1.6.9/sbin/functions.sh 2005-01-30 20:32:34.000000000 +0100 +++ rc-scripts-1.6.9-vserver/sbin/functions.sh 2005-02-05 11:22:42.565445304 +0100 @@ -658,6 +658,36 @@ return 1 } +## vserver-support +## Idea: we simply check if we are on a root- or v-server and react accordingly. +## If there is no "s_context:" at all we have a vanilla (i.e. non-vserver) system +## that is treated like a root-server. + +# void get_vserver_context(void) +# +# prints the context number if any +# +get_vserver_context() { + [ -f /proc/$$/status ] && awk '/^s_context:/ { print $2; }' /proc/$$/status +} + +# bool is_vserver_host(void) +# +# return 0 if we are on the host +is_vserver_host() { + local context=$(get_vserver_context) + [ "x${context}" = "x0" -o "x${context}" = "x" ] && return 0 + return 1 +} + +# bool is_vserver_guest(void) +# +# return 0 if we are on the guest +is_vserver_guest() { + is_vserver_host && return 1 + return 0 +} + ############################################################################## # #