summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Imhof <tantive@gentoo.org>2004-03-29 12:11:05 +0000
committerMichael Imhof <tantive@gentoo.org>2004-03-29 12:11:05 +0000
commit8e4b51f149428b3769715f5aeccd285db8769b1d (patch)
tree8950b9ab339cf9ad78bd3551bf741674702190fd /sys-cluster
parentdep for bricolage, bug 21549 (diff)
downloadhistorical-8e4b51f149428b3769715f5aeccd285db8769b1d.tar.gz
historical-8e4b51f149428b3769715f5aeccd285db8769b1d.tar.bz2
historical-8e4b51f149428b3769715f5aeccd285db8769b1d.zip
More fixes. Closes #45729.
Diffstat (limited to 'sys-cluster')
-rw-r--r--sys-cluster/util-vserver/Manifest4
-rw-r--r--sys-cluster/util-vserver/files/rebootmgr.initd44
-rw-r--r--sys-cluster/util-vserver/files/vservers.initd111
-rw-r--r--sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild6
4 files changed, 163 insertions, 2 deletions
diff --git a/sys-cluster/util-vserver/Manifest b/sys-cluster/util-vserver/Manifest
index 2f5c0bf35845..c9b5e69f0faf 100644
--- a/sys-cluster/util-vserver/Manifest
+++ b/sys-cluster/util-vserver/Manifest
@@ -1,6 +1,8 @@
MD5 367dc6038258eb7c0270a2199a12db92 util-vserver-0.29.ebuild 969
MD5 7de4c37a189ad9dce261c6b8afdf79ea ChangeLog 610
-MD5 24588b65e852bc63d33a2d5b72952ffd util-vserver-0.29_p196-r1.ebuild 1252
+MD5 fa2d1a3edfd9ac053615193958d8987e util-vserver-0.29_p196-r1.ebuild 1381
MD5 af1503bee29c51dd40f8a675c89c47d8 files/digest-util-vserver-0.29_p196-r1 74
+MD5 1cb2a7908a23ba002862f1885b136418 files/vservers.initd 2501
+MD5 3fb961ce171c0f04c695c76f698daa94 files/rebootmgr.initd 966
MD5 1227d155ce30bb72ad0f511ce77c7535 files/digest-util-vserver-0.29 70
MD5 b2b8518d47de9e56f0ddbe7c724c5153 files/configure.patch 588
diff --git a/sys-cluster/util-vserver/files/rebootmgr.initd b/sys-cluster/util-vserver/files/rebootmgr.initd
new file mode 100644
index 000000000000..5d2375b4e934
--- /dev/null
+++ b/sys-cluster/util-vserver/files/rebootmgr.initd
@@ -0,0 +1,44 @@
+#!/sbin/runscript
+## description: The rebootmgr service is monitoring all virtual servers \
+## and restart them as need. Virtual servers are using \
+## the /sbin/vreboot command to talk with the reboot manager
+##
+## TODO: replace "echo" by "estart", add "eend", use "start-stop-daemon", ...
+
+DEFAULT_VSERVERDIR=/vservers
+USR_SBIN=/usr/sbin
+PIDFILE=/var/run/rebootmgr.pid
+
+start() {
+ echo "Starting the reboot manager"
+ cd /etc/vservers
+ VSERVERS=
+ for serv in *.conf
+ do
+ test -f "$serv" || continue
+
+ serv=`basename $serv .conf`
+ if [ -d $DEFAULT_VSERVERDIR/$serv ] ; then
+ VSERVERS="$VSERVERS $serv"
+ fi
+ done
+ $USR_SBIN/rebootmgr --pidfile $PIDFILE $VSERVERS &
+}
+
+stop() {
+ echo "Stopping the reboot manager"
+ kill `cat $PIDFILE`
+ rm -f $PIDFILE
+}
+
+## TODO: do we want this?
+my_status() {
+ if [ -f $PIDFILE ] ; then
+ if kill -0 `cat $PIDFILE`
+ then
+ echo rebootmgr is running
+ else
+ echo rebootmgr is NOT running
+ fi
+ fi
+}
diff --git a/sys-cluster/util-vserver/files/vservers.initd b/sys-cluster/util-vserver/files/vservers.initd
new file mode 100644
index 000000000000..f7af525e7511
--- /dev/null
+++ b/sys-cluster/util-vserver/files/vservers.initd
@@ -0,0 +1,111 @@
+#!/sbin/runscript
+##
+## description: The vservers service is used to start and stop all
+## the virtual servers.
+## to configure see:
+## - /etc/vservers/*.conf
+## - /etc/vservers.conf
+
+USR_SBIN=/usr/sbin
+
+depend() {
+ need net rebootmgr
+}
+
+## we need to call this _before_ starting any vserver!
+proc_security() {
+ ## the following does not seem to work (maybe "old-style" only?):
+ ### from: http://vserver.strahlungsfrei.de/tiki-index.php?page=VServerGentooNew
+ ## enable (parts of) the proc filesystem
+ #vproc -e /proc/cmdline
+ #vproc -e /proc/loadavg
+ #vproc -e /proc/meminfo
+ ### invalid ioctl for /proc/mounts!!
+ ##vproc -e /proc/mounts
+ #vproc -e /proc/stat
+ #vproc -e /proc/uptime
+ ## (vproc -e /proc/version)
+ ## (useful and harmless: cpuinfo, slabinfo, interrupts)
+ #vproc -e /proc/cpuinfo
+ #vproc -e /proc/slabinfo
+ #vproc -e /proc/interrupts
+
+ ## anyway, we use the following for now:
+ /usr/sbin/setattr -R --~hide /proc/*
+}
+
+# Print the vserver name in priority/alpha order
+sortserver(){
+ (
+ cd /etc/vservers
+ for serv in *.conf
+ do
+ test -f "$serv" || continue
+
+ PRIORITY=100
+ . $serv
+ test "$ONBOOT" || continue
+ printf "%03d %s\n" $PRIORITY `basename $serv .conf`
+ done
+ ) | sort $* | (while read a b; do echo $b; done)
+}
+
+startservers(){
+ echo "Starting the virtual servers"
+ cd /etc/vservers
+ for name in `sortserver`
+ do
+ ONBOOT=
+ . $name.conf
+ if [ "$ONBOOT" = "yes" ] ; then
+ echo; echo
+ echo "*** starting vserver \"$name\" ($(date)) ***"
+ $USR_SBIN/vserver $name start
+ else
+ echo "*** vserver \"$name\" not configured for on boot start ***"
+ fi
+ done
+}
+
+BACKGROUND=off
+if [ -f /etc/vservers.conf ] ; then
+ . /etc/vservers.conf
+fi
+
+
+# See how we were called.
+start() {
+ proc_security
+ if [ "$BACKGROUND" = "yes" ] ; then
+ einfo "asynchronous start of vserver on tty8"
+ echo "vserver startup on $(date)" 2>&1 </dev/tty8 | tee /var/log/vservers.boot >/dev/tty8
+ #startservers >/dev/tty8 </dev/tty8 2>/dev/tty8 &
+ startservers 2>&1 </dev/tty8 | tee /var/log/vservers.boot >/dev/tty8 &
+ else
+ estart "synchronous vserver-start"
+ startservers | tee /var/log/vservers.boot
+ eend $?
+ fi
+}
+
+stop() {
+ echo "Stopping the virtual servers"
+ cd /etc/vservers
+ for name in `sortserver -r`
+ do
+ $USR_SBIN/vserver $name stop
+ done
+}
+
+## TODO: finish our status()-function
+my_status() {
+ cd /etc/vservers
+ for serv in *.conf
+ do
+ ONBOOT=no
+ name=`basename $serv .conf`
+ . $serv
+ echo -n ONBOOT=$ONBOOT " "
+ $USR_SBIN/vserver $name running
+ done
+}
diff --git a/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild b/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild
index 90681429ae47..080696c21e85 100644
--- a/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild
+++ b/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild,v 1.1 2004/03/25 20:03:29 tantive Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/util-vserver-0.29_p196-r1.ebuild,v 1.2 2004/03/29 12:11:05 tantive Exp $
MY_P="${P/_p/.}"
DESCRIPTION="Vserver admin-tools."
@@ -40,4 +40,8 @@ src_install() {
## remove the non-gentoo init-scripts:
rm -r ${D}/etc/init.d
+ ## ... and install gentoo'ized ones:
+ insinto /etc/init.d/
+ doins ${FILESDIR}/vservers.initd
+ doins ${FILESDIR}/rebootmgr.initd
}