using tagged config for gnuradio
[build.git] / vbuild-init-vserver.sh
index 30818dd..4c71dd2 100755 (executable)
@@ -2,6 +2,8 @@
 # -*-shell-*-
 # $Id$
 
+#shopt -s huponexit
+
 COMMAND=$(basename $0)
 DIRNAME=$(dirname $0)
 
@@ -180,17 +182,20 @@ function setup_vserver () {
     fi
 
     # start the vserver so we can do the following operations
+#    rm -f /tmp/go*
+#    echo -n ' about to start - WAITING for /tmp/go1' ; while true ; do [ -f /tmp/go1 ] && break || : ; done
     $personality vserver $VERBOSE $vserver start
+#    echo -n ' started - WAITING for /tmp/go2' ; while true ; do [ -f /tmp/go2 ] && break || : ; done
+#if true ; then 
+#    echo SKIPPING for debug --- vserver was started
+#else
     [ "$pkg_method" = "yum" ] && $personality vserver $VERBOSE $vserver exec sh -c "rm -f /var/lib/rpm/__db*"
     [ "$pkg_method" = "yum" ] && $personality vserver $VERBOSE $vserver exec rpm --rebuilddb
 
-    # with vserver 2.3, granting the vserver CAP_MKNOD is not enough
-    # check whether we run vs2.3 or above
-    vs_version=$(uname -a  | sed -e 's,.*[\.\-]vs\([0-9]\)\.\([0-9]\)\..*,\1\2,')
-    # at this stage we have here 22 or 23
-    need_vdevmap=$(( $vs_version >= 23 ))
+    # check if the vserver kernel is using VSERVER_DEVICE (vdevmap) support
+    need_vdevmap=$(grep "CONFIG_VSERVER_DEVICE=y" /boot/config-$(uname -r) | wc -l)
 
-    if [ "$need_vdevmap" == 1 ] ; then
+    if [ $need_vdevmap -eq 1 ] ; then
        ctx=$(cat /etc/vservers/$vserver/context)
        vdevmap --set --xid $ctx --open --create --target /dev/null
        vdevmap --set --xid $ctx --open --create --target /dev/root
@@ -203,6 +208,9 @@ function setup_vserver () {
     cp /etc/resolv.conf /vservers/$vserver/etc/resolv.conf
     # and /etc/hosts for at least localhost
     [ -f /vservers/$vserver/etc/hosts ] || echo "127.0.0.1 localhost localhost.localdomain" > /vservers/$vserver/etc/hosts
+
+#fi
+
 }
 
 function devel_or_vtest_tools () {