From 732a86ac5e988c1be41076b609266130bdb3e8bb Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Thu, 30 Oct 2003 17:30:04 +0000 Subject: [PATCH] merged in changes from 0.24.94 (s!/usr/sbin!$SBINDIR!) git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@340 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/scripts/distrib-info | 15 ++++++++++----- util-vserver/scripts/rootshell | 9 +++++++-- util-vserver/scripts/vpstree | 9 ++++++++- util-vserver/scripts/vserver-copy | 15 +++++++++++---- util-vserver/scripts/vsysvwrapper | 12 +++++++++--- util-vserver/scripts/vtop | 9 +++++++-- 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/util-vserver/scripts/distrib-info b/util-vserver/scripts/distrib-info index 6bbddfb..a493ab3 100755 --- a/util-vserver/scripts/distrib-info +++ b/util-vserver/scripts/distrib-info @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (C) 2003 Enrico Scholz # based on distrib-info by Jacques Gelinas @@ -25,7 +25,12 @@ # distrib-info vserver1 pkgversion # If vserver1 is a redhat system, it executes # rpm -qa --queryformat "%{name}=%{version}-%{release} -USR_LIB_VSERVER=$(dirname $0) +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" if [ "$1" = "" ] ; then echo distrib-info vserver-name command [ args ... ] >&2 @@ -40,10 +45,10 @@ if [ "$1" = "/" ] ; then CHROOTCMD= elif [ -d "$1" ] ; then DISTDIR=$1 - CHROOTCMD="/usr/sbin/chroot $DISTDIR" + CHROOTCMD="$SBINDIR/chroot $DISTDIR" else DISTDIR=/vservers/$1 - CHROOTCMD="/usr/sbin/chroot $DISTDIR" + CHROOTCMD="$SBINDIR/chroot $DISTDIR" fi KEY=$2 shift @@ -57,7 +62,7 @@ if [ -f $DIRDIR/etc/redhat-release -o -f $DISTDIR/etc/mandrake-release ] ; then # We remove /etc and /var/log to make sure no special file # there will be unified $CHROOTCMD /bin/rpm -ql --dump $* \ - | $USR_LIB_VSERVER/parserpmdump /etc/ + | $PKGLIBDIR/parserpmdump /etc/ ;; dumpfiles) $CHROOTCMD /bin/rpm -ql $* diff --git a/util-vserver/scripts/rootshell b/util-vserver/scripts/rootshell index 7586d46..0331278 100755 --- a/util-vserver/scripts/rootshell +++ b/util-vserver/scripts/rootshell @@ -16,11 +16,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" -echo $* >/tmp/log OPTIONS=$@ if [ "$OPTIONS" = "" ] ; then OPTIONS=--login fi -exec /usr/sbin/chbind --silent --ip 0.0.0.0 /bin/bash $OPTIONS +exec $SBINDIR/chbind --silent --ip 0.0.0.0 /bin/bash $OPTIONS diff --git a/util-vserver/scripts/vpstree b/util-vserver/scripts/vpstree index e785a46..b918308 100755 --- a/util-vserver/scripts/vpstree +++ b/util-vserver/scripts/vpstree @@ -18,6 +18,13 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #Presents the processes running in all virtual servers -exec /usr/sbin/chcontext --silent --ctx 1 pstree $* +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" + +exec $SBINDIR/chcontext --silent --ctx 1 pstree $* diff --git a/util-vserver/scripts/vserver-copy b/util-vserver/scripts/vserver-copy index deb6f9f..321cfda 100755 --- a/util-vserver/scripts/vserver-copy +++ b/util-vserver/scripts/vserver-copy @@ -36,6 +36,13 @@ # used so that if/when you reboot the source roothost you don't have the # same vserver and IP address running on two machines. +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" + VERSION="0.4" umask 022 me=${0##*/} @@ -271,7 +278,7 @@ if [ -n "$ip" ] && \ fi # This works both locally and remote -if ($shcmd $dhost /usr/sbin/vserver $newname running | grep 'is running'); then +if ($shcmd $dhost $SBINDIR/vserver $newname running | grep 'is running'); then warn "destination vserver \"$newname\" is running" error 1 "Cannot copy over a running vserver" fi @@ -283,7 +290,7 @@ info "Attempting to copy $vserver to $dhost$colon$newname" if $stopstart; then info "Stopping virtual server \"$vserver\" on localhost" - /usr/sbin/vserver $vserver stop + $SBINDIR/vserver $vserver stop fi info "Syncing directories" @@ -358,8 +365,8 @@ fi if $stopstart; then info "Starting virtual server \"$vserver\" on $dhost" - $shcmd $dhost /usr/sbin/vserver $vserver start - if ($shcmd $dhost /usr/sbin/vserver $vserver running | \ + $shcmd $dhost $SBINDIR/vserver $vserver start + if ($shcmd $dhost $SBINDIR/vserver $vserver running | \ grep 'not running'); then error 1 "Virtual server \"$vserver\" failed to start on $dhost" fi diff --git a/util-vserver/scripts/vsysvwrapper b/util-vserver/scripts/vsysvwrapper index 309a9d1..f26ccf5 100755 --- a/util-vserver/scripts/vsysvwrapper +++ b/util-vserver/scripts/vsysvwrapper @@ -18,7 +18,13 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Helper script for all the v_xxx scripts -USR_SBIN=/usr/sbin +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" + if [ $# = 0 ] ; then echo vsysvwrapper service_name >&2 else @@ -33,8 +39,8 @@ else do IPOPT="$IPOPT --ip $oneip" done - echo exec $USR_SBIN/chbind $IPOPT /etc/init.d/$SERVICE $* - exec $USR_SBIN/chbind $IPOPT /etc/init.d/$SERVICE $* + echo exec $SBINDIR/chbind $IPOPT /etc/init.d/$SERVICE $* + exec $SBINDIR/chbind $IPOPT /etc/init.d/$SERVICE $* fi diff --git a/util-vserver/scripts/vtop b/util-vserver/scripts/vtop index 0b4585c..ae32b54 100755 --- a/util-vserver/scripts/vtop +++ b/util-vserver/scripts/vtop @@ -18,6 +18,11 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #Presents the processes running in all virtual servers -exec /usr/sbin/chcontext --silent --ctx 1 top $* - +: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." + exit 1 +} +. "$UTIL_VSERVER_VARS" +exec $SBINDIR/chcontext --silent --ctx 1 top $* -- 1.8.1.5