base @PKGLIBDIR@/vserver.stop
base @PKGLIBDIR@/vserver.suexec
base @PKGLIBDIR@/vserver.delete
+sysv @PKGLIBDIR@/vserver-init.functions
core @PKGLIBDIR@/util-vserver-vars
build @PKGLIBDIR@/rpm-fake.so
legacy @LEGACYDIR@/save_s_context
legacy @CONFIG@ @INITRDDIR@/v_xinetd
sysv @CONFIG@ @INITRDDIR@/vprocunhide
sysv @CONFIG@ @INITRDDIR@/vservers-default
+sysv @CONFIG@ @INITRDDIR@/util-vserver
legacy @CONFIG@ @INITRDDIR@/rebootmgr
legacy @CONFIG@ @INITRDDIR@/vservers-legacy
legacy @CONFIG_NOREPLACE@ @SYSCONFDIR@/vservers.conf
scripts/vserver.start \
scripts/vserver.stop \
scripts/vserver.suexec \
- scripts/vserver.delete
+ scripts/vserver.delete \
+ scripts/vserver-init.functions
scripts_pkglib_gen_DTA = scripts/util-vserver-vars
_KEEP_CTX_ALIVE="$__PKGLIBDIR/keep-ctx-alive"
_LIB_FUNCTIONS="$__PKGLIBDIR/functions"
_LIB_MAGIC="$__PKGLIBDIR/magic"
+_LIB_VSERVER_INIT_FUNCTIONS="$__PKGLIBDIR/vserver-init.functions"
_LIB_VSERVER_SETUP_FUNCTIONS="$__PKGLIBDIR/vserver-setup.functions"
_LIB_VSERVER_BUILD_FUNCTIONS="$__PKGLIBDIR/vserver-build.functions"
_LIB_VSERVER_BUILD_FUNCTIONS_APT="$__PKGLIBDIR/vserver-build.functions.apt"
--- /dev/null
+#! /bin/bash
+
+# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if test -e /etc/init.d/functions; then
+ . /etc/init.d/functions
+ _beginResult() { echo -n "$@..."; }
+ _postResult() { echo; }
+ lockfile=/var/lock/subsys/$LOCKFILE
+elif test -e /etc/gentoo-release; then
+ . /sbin/functions.sh
+ _beginResult() { ebegin "$@"; }
+ _postResult() { :; }
+ success() { eend 0; }
+ passed() { eend 0; }
+ failure() { eend 1; }
+ lockfile=/var/lock/vservers/$LOCKFILE
+else
+ _beginResult() { echo -n "$@..."; }
+ _postResult() { :; }
+ success() { echo .; }
+ passed() { echo .; }
+ failure() { echo ERROR; }
+ lockfile=/var/run/$LOCKFILE
+fi
+
+function _endResult()
+{
+ local rc=$1
+ case "$rc" in
+ (0) success;;
+ (2) passed; rc=0;;
+ (*) failure;;
+ esac
+ _postResult
+ return $rc
+}
: ${LOCKFILE:=vservers-$MARK}
: ${NUMPARALLEL:=6}
-
-if test -e /etc/init.d/functions; then
- . /etc/init.d/functions
- _beginResult() { echo -n "$@ ..."; }
- _postResult() { echo; }
- lockfile=/var/lock/subsys/$LOCKFILE
-elif test -e /etc/gentoo-release; then
- . /sbin/functions.sh
- _beginResult() { ebegin "$@"; }
- _postResult() { :; }
- success() { eend 0; }
- passed() { eend 0; }
- failure() { eend 1; }
- lockfile=/var/lock/vservers/$LOCKFILE
-else
- _beginResult() { echo -n "$@ ..."; }
- _postResult() { :; }
- success() { echo .; }
- passed() { echo .; }
- failure() { echo ERROR; }
- lockfile=/var/run/$LOCKFILE
-fi
-
-function _endResult()
-{
- local rc=$1
- case "$rc" in
- (0) success;;
- (2) passed; rc=0;;
- (*) failure;;
- esac
- _postResult
- return $rc
-}
+. "$_LIB_VSERVER_INIT_FUNCTIONS"
function start()
{
sysv_src_SCRPTS = sysv/rebootmgr \
sysv/vprocunhide \
sysv/vservers-default \
- sysv/vservers-legacy
+ sysv/vservers-legacy \
+ sysv/util-vserver
sysv_gen_SCRPTS = sysv/v_gated \
sysv/v_httpd \
sysv/v_named \
--- /dev/null
+#!/bin/bash
+#
+# util-vserver sets the path to vshelper and kills all guest processes
+#
+# chkconfig: 2345 10 90
+# description: Sets the path to vshelper and kills all guest processes
+
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+
+LOCKFILE=util-vserver
+. "$_LIB_VSERVER_INIT_FUNCTIONS"
+
+
+function set_helper()
+{
+ local f="/proc/sys/kernel/vshelper"
+ if test -e "$f"; then
+ echo "$_VSHELPER" > "$f"
+ return 0
+ else
+ return 2
+ fi
+}
+
+function kill_contexts()
+{
+ for xid in `ls -1 /proc/virtual`; do
+ test "$xid" = "info" -o "$xid" = "status" && continue
+ $_VATTRIBUTE --xid $xid --set --flag ~persistent
+ $_VKILL --xid $xid -s 15
+ sleep 3
+ $_VKILL --xid $xid -s 9
+ done
+}
+
+function start()
+{
+ _beginResult $"Setting path to vshelper"
+ set_helper
+ _endResult $?
+ local retval=$?
+ test "$retval" -ne 0 || touch "$lockfile"
+ return $retval
+}
+
+function stop()
+{
+ # Stop all running, but non-default guests"
+ _beginResult $"Stopping all running guests"
+ $_START_VSERVERS -j 1 --all --stop
+ _endResult $?
+ local retval=$?
+ _beginResult $"Killing all running contexts"
+ kill_contexts
+ _endResult $?
+ $_RM -f "$lockfile"
+}
+
+function restart()
+{
+ stop
+ start
+}
+
+case "$1" in
+ start|stop|restart) $1;;
+ reload) ;;
+ condrestart)
+ test -f $lockfile && restart || :
+ ;;
+ status)
+ test -f $lockfile && {
+ echo $"/proc entries were fixed"
+ exit 0
+ }
+ echo $"/proc entries are not fixed"
+ exit 1
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
+ exit 2
+ ;;
+esac
$_VSERVER_INFO - FEATURE iattr || exit 0
-f=/etc/rc.d/init.d/functions
-if test -e "$f"; then
- . "$f"
- lockfile=/var/lock/subsys/vprocunhide
-else
- success() { echo .; }
- passed() { echo .; }
- failure() { echo ERROR; }
- lockfile=/var/run/vprocunhide
-fi
+LOCKFILE=vprocunhide
+. "$_LIB_VSERVER_INIT_FUNCTIONS"
function start()
{
- echo -n $"Fixing /proc entries visibility..."
+ _beginResult $"Fixing /proc entries visibility"
$_VPROCUNHIDE
- retval=$?
- case "$retval" in
- 0) success;;
- 2) passed; retval=0;;
- *) failure;
- esac
- echo
+ _endResult $?
+ local retval=$?
test "$retval" -ne 0 || touch "$lockfile"
return $retval
}
function stop()
{
- rm -f "$lockfile"
+ $_RM -f "$lockfile"
}
function restart()