? vserver.patch Index: init.d/clock =================================================================== RCS file: /var/cvsroot/gentoo-src/rc-scripts/init.d/clock,v retrieving revision 1.24.2.1 diff -u -r1.24.2.1 clock --- init.d/clock 30 Jan 2005 21:23:10 -0000 1.24.2.1 +++ init.d/clock 6 Feb 2005 09:46:40 -0000 @@ -12,9 +12,15 @@ setupopts() { if is_uml_sys ; then TBLURB="UML" + fakeit=1 + return 0 + elif is_vserver_sys ; then + TBLURB="VServer" + fakeit=1 return 0 elif grep -q ' cobd$' /proc/devices ; then TBLURB="coLinux" + fakeit=1 return 0 elif [[ ${CLOCK} == "UTC" ]] ; then myopts="--utc" @@ -47,7 +53,7 @@ start() { local myopts="" local myadj="" - local TBLURB="" + local TBLURB="" fakeit=0 local errstr="" local readonly="no" local ret=0 @@ -61,7 +67,7 @@ setupopts ebegin "Setting system clock to hardware clock [${TBLURB}]" - if [[ ${TBLURB} == "UML" ]] || [[ ${TBLURB} == "coLinux" ]] ; then + if [[ ${fakeit} -eq 1 ]] ; then ret=0 elif [[ -x /sbin/hwclock ]] ; then Index: init.d/halt.sh =================================================================== RCS file: /var/cvsroot/gentoo-src/rc-scripts/init.d/halt.sh,v retrieving revision 1.64.2.4 diff -u -r1.64.2.4 halt.sh --- init.d/halt.sh 4 Feb 2005 06:24:42 -0000 1.64.2.4 +++ init.d/halt.sh 6 Feb 2005 09:46:41 -0000 @@ -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.4 2005/02/04 06:24:42 vapier Exp $ +# Linux VServers don't need to handle mounts/etc... +is_vserver_sys && 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" ] && \ Index: init.d/modules =================================================================== RCS file: /var/cvsroot/gentoo-src/rc-scripts/init.d/modules,v retrieving revision 1.32.4.1 diff -u -r1.32.4.1 modules --- init.d/modules 30 Jan 2005 22:17:37 -0000 1.32.4.1 +++ init.d/modules 6 Feb 2005 09:46:41 -0000 @@ -73,6 +73,9 @@ # support compiled in ... [ -f /proc/modules ] || return 0 + # VServer's don't do modules + is_vserver_sys && return 0 + # Here we should fail, as a modular kernel do need # depmod command ... if [ ! -x /sbin/depmod ] Index: sbin/functions.sh =================================================================== RCS file: /var/cvsroot/gentoo-src/rc-scripts/sbin/functions.sh,v retrieving revision 1.81.2.3 diff -u -r1.81.2.3 functions.sh --- sbin/functions.sh 30 Jan 2005 19:32:34 -0000 1.81.2.3 +++ sbin/functions.sh 6 Feb 2005 09:46:41 -0000 @@ -615,7 +615,18 @@ # EXAMPLE: if is_uml_sys ; then ... # is_uml_sys() { - grep -q 'UML' /proc/cpuinfo &> /dev/null + grep -qs 'UML' /proc/cpuinfo + return $? +} + +# bool is_vserver_sys() +# +# return 0 if the currently running system is a Linux VServer +# +# EXAMPLE: if is_vserver_sys ; then ... +# +is_vserver_sys() { + grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status return $? }