use customizable paths for '/usr/sbin'
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Thu, 30 Oct 2003 00:36:03 +0000 (00:36 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Thu, 30 Oct 2003 00:36:03 +0000 (00:36 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@304 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/scripts/vpstree
util-vserver/scripts/vrpm
util-vserver/scripts/vserver-copy
util-vserver/scripts/vsysvwrapper
util-vserver/scripts/vtop
util-vserver/src/rebootmgr.c

index e785a46..b918308 100755 (executable)
 # 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 $*
 
 
index 8c5e8d5..3e049ac 100755 (executable)
@@ -77,7 +77,7 @@ else
                        fi
                        #echo rpm --root /vservers/$serv $*
                        echo Updating server $serv
-                       /usr/sbin/chcontext --silent $CTXOPT rpm --root /vservers/$serv $*
+                       $SBINDIR/chcontext --silent $CTXOPT rpm --root /vservers/$serv $*
                done
                if [ "$UNIFY" = "yes" ] ; then
                        PACKAGES=
index deb6f9f..321cfda 100755 (executable)
 #   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
index 309a9d1..f26ccf5 100755 (executable)
 # 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
 
 
index 0b4585c..ae32b54 100755 (executable)
 # 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 $*
index 2b1882f..3e5f5c2 100644 (file)
@@ -104,13 +104,13 @@ static int rebootmgr_process (int fd, const char *vname)
                if (strcmp(buf,"reboot\n")==0){
                        char cmd[1000];
                        syslog (LOG_NOTICE,"reboot vserver %s\n",vname);
-                       snprintf (cmd,sizeof(cmd)-1,"/usr/sbin/vserver %s restart >>/var/log/boot.log 2>&1",vname);
+                       snprintf (cmd,sizeof(cmd)-1,"%s/vserver %s restart >>/var/log/boot.log 2>&1",SBINDIR, vname);
                        system (cmd);
                        ret = 0;
                }else if (strcmp(buf,"halt\n")==0){
                        char cmd[1000];
                        syslog (LOG_NOTICE,"halt vserver %s\n",vname);
-                       snprintf (cmd,sizeof(cmd)-1,"/usr/sbin/vserver %s stop >>/var/log/boot.log 2>&1",vname);
+                       snprintf (cmd,sizeof(cmd)-1,"%s/vserver %s stop >>/var/log/boot.log 2>&1",SBINDIR, vname);
                        system (cmd);
                        ret = 0;
                }else{