From: Enrico Scholz Date: Thu, 30 Oct 2003 15:17:33 +0000 (+0000) Subject: use customizable value for vserver-rootdir instead of hardcoded '/vservers' X-Git-Tag: version_0_23_96~6 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ce65e34588852108bb0ca8d023ce3bb2d07473f;p=util-vserver.git use customizable value for vserver-rootdir instead of hardcoded '/vservers' import the global configuration file (util-vserver-vars) git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@326 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/distrib/install-mdk8.2 b/util-vserver/distrib/install-mdk8.2 index 5212ca4..af967dd 100644 --- a/util-vserver/distrib/install-mdk8.2 +++ b/util-vserver/distrib/install-mdk8.2 @@ -24,17 +24,25 @@ # Specify the name of the vserver # "install-mdk8.2 test" will create /vservers/test -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" + +USR_LIB_VSERVER=$PKGLIBDIR + if [ $# -lt 1 ] ; then echo install-mdk8.2 vserver-id [ type ] echo type minimum means, minimum package for a server echo type large means, all packages on the first CD -elif [ -d /vservers/$1/var/lib/rpm ] ; then - echo /vservers/$1 already exist +elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then + echo $VROOTDIR/$1 already exist elif [ ! -d /mnt/cdrom/Mandrake/RPMS ] ; then echo No rpms in /mnt/cdrom/Mandrake/RPMS. Is the CD mounted \? else - VROOT=/vservers/$1 + VROOT=$VROOTDIR/$1 $USR_LIB_VSERVER/install-pre.sh $1 mkdir -p $VROOT/proc mount -t proc none $VROOT/proc diff --git a/util-vserver/distrib/install-post.sh b/util-vserver/distrib/install-post.sh index d877321..b1d1929 100644 --- a/util-vserver/distrib/install-post.sh +++ b/util-vserver/distrib/install-post.sh @@ -18,7 +18,15 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Complete the installation of a vserver -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" + +USR_LIB_VSERVER=$PKGLIBDIR + vserver_mknod() { mknod $1 $2 $3 $4 @@ -28,7 +36,7 @@ vserver_mknod() if [ $# != 1 ] ; then echo install-post.sh vserver else - VROOT=/vservers/$1 + VROOT=$VROOTDIR/$1 rm -fr $VROOT/dev mkdir $VROOT/dev && chmod 755 $VROOT/dev mkdir $VROOT/dev/pts @@ -51,7 +59,7 @@ else *.bak|*~|functions|killall|halt|single) ;; *) - $USR_LIB_VSERVER/capchroot /vservers/$1 /sbin/chkconfig --level 2345 $serv off + $USR_LIB_VSERVER/capchroot $VROOTDIR/$1 /sbin/chkconfig --level 2345 $serv off ;; esac done diff --git a/util-vserver/distrib/install-pre.sh b/util-vserver/distrib/install-pre.sh index 262a5f6..6eab83b 100644 --- a/util-vserver/distrib/install-pre.sh +++ b/util-vserver/distrib/install-pre.sh @@ -17,6 +17,13 @@ # 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" + vserver_mknod() { mknod $1 $2 $3 $4 @@ -27,8 +34,8 @@ if [ $# != 1 ] ; then echo install-pre.sh vserver else mkdir -p /etc/vservers - mkdir -p /vservers 2>/dev/null - VROOT=/vservers/$1 + mkdir -p $VROOTDIR 2>/dev/null + VROOT=$VROOTDIR/$1 rm -fr $VROOT/dev mkdir -p $VROOT/dev && chmod 755 $VROOT/dev mkdir $VROOT/dev/pts diff --git a/util-vserver/distrib/install-rh7.2 b/util-vserver/distrib/install-rh7.2 index b3bd0ca..3108962 100644 --- a/util-vserver/distrib/install-rh7.2 +++ b/util-vserver/distrib/install-rh7.2 @@ -23,17 +23,25 @@ # Specify the name of the vserver # "install-rh7.2 test" will create /vservers/test -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" + +USR_LIB_VSERVER=$PKGLIBDIR + if [ $# != 1 ] ; then echo install-rh7.2 vserver-id -elif [ -d /vservers/$1/var/lib/rpm ] ; then - echo /vservers/$1 already exist +elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then + echo $VROOTDIR/$1 already exist elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \? else echo `ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \ /mnt/cdrom/RedHat/RPMS/*.i386.rpm | wc -l` packages to install - VROOT=/vservers/$1 + VROOT=$VROOTDIR/$1 mkdir -p $VROOT/proc mount -t proc none $VROOT/proc mkdir -p $VROOT/var/lib/rpm diff --git a/util-vserver/distrib/install-rh7.3 b/util-vserver/distrib/install-rh7.3 index b50d14a..9660c5e 100644 --- a/util-vserver/distrib/install-rh7.3 +++ b/util-vserver/distrib/install-rh7.3 @@ -23,17 +23,25 @@ # Specify the name of the vserver # "install-rh7.3 test" will create /vservers/test -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" + +USR_LIB_VSERVER=$PKGLIBDIR + if [ $# -lt 1 ] ; then echo install-rh7.3 vserver-id [ type ] echo type minimum means, minimum package for a server echo type large means, all packages on the first CD -elif [ -d /vservers/$1/var/lib/rpm ] ; then - echo /vservers/$1 already exist +elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then + echo $VROOTDIR/$1 already exist elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \? else - VROOT=/vservers/$1 + VROOT=$VROOTDIR/$1 mkdir -p $VROOT/proc mount -t proc none $VROOT/proc mkdir -p $VROOT/var/lib/rpm diff --git a/util-vserver/distrib/install-rh8.0 b/util-vserver/distrib/install-rh8.0 index 625c3a8..d455f18 100644 --- a/util-vserver/distrib/install-rh8.0 +++ b/util-vserver/distrib/install-rh8.0 @@ -22,17 +22,25 @@ # Specify the name of the vserver # "install-rh8.0 test" will create /vservers/test -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" + +USR_LIB_VSERVER=$PKGLIBDIR + if [ $# -lt 1 ] ; then echo install-rh8.0 vserver-id [ type ] echo type minimum means, minimum package for a server echo type large means, all packages on the first CD -elif [ -d /vservers/$1/var/lib/rpm ] ; then - echo /vservers/$1 already exist +elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then + echo $VROOTDIR/$1 already exist elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \? else - VROOT=/vservers/$1 + VROOT=$VROOTDIR/$1 $USR_LIB_VSERVER/install-pre.sh $1 mkdir -p $VROOT/proc mount -t proc none $VROOT/proc diff --git a/util-vserver/distrib/install-rh9.0 b/util-vserver/distrib/install-rh9.0 index 6aa639b..7efc439 100644 --- a/util-vserver/distrib/install-rh9.0 +++ b/util-vserver/distrib/install-rh9.0 @@ -22,17 +22,25 @@ # Specify the name of the vserver # "install-rh9.0 test" will create /vservers/test -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" + +USR_LIB_VSERVER=$PKGLIBDIR + if [ $# -lt 1 ] ; then echo install-rh9.0 vserver-id [ type ] echo type minimum means, minimum package for a server echo type large means, all packages on the first CD -elif [ -d /vservers/$1/var/lib/rpm ] ; then - echo /vservers/$1 already exist +elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then + echo $VROOTDIR/$1 already exist elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \? else - VROOT=/vservers/$1 + VROOT=$VROOTDIR/$1 $USR_LIB_VSERVER/install-pre.sh $1 mkdir -p $VROOT/proc mount -t proc none $VROOT/proc