use master for tests for show-plc
[build.git] / vbuild-init-vserver.sh
index 22a71df..3f69cd9 100755 (executable)
@@ -149,8 +149,8 @@ function setup_vserver () {
        echo "* ${i}-th attempt to 'vserver build' failed - waiting for 3 seconds"
        sleep 3
     done
-    # check success
-    [ -d /vservers/$vserver ] 
+    # check success - not enough to check for the directory, let's assume /etc/ in image
+    [ -d /vservers/$vserver/etc ] 
 
     if [ ! -z "$personality" ] ; then
        if [ -f "/etc/vservers/$vserver/personality" ] ; then
@@ -192,9 +192,6 @@ function setup_vserver () {
     # Enable cgroup
     mkdir /etc/vservers/$vserver/cgroup
 
-    # Start Vserver automatically on boot
-    echo "default" > /etc/vservers/$vserver/apps/init/mark
-
     # Set the init style of your vserver to plain for f15 and higher
     # not working with f15 anyways, systemd requires 2.6.36 to work
     case $fcdistro in 
@@ -461,6 +458,7 @@ function usage () {
     echo " -d pldistro - defaults to $DEFAULT_PLDISTRO"
     echo " -p personality - defaults to $DEFAULT_PERSONALITY"
     echo " -i ifname: determines ip and netmask attached to ifname, and passes it to the vserver"
+    echo " -r : set apps/init/mark to default so the vserver restart upon reboot"
     echo " -v : verbose - passes -v to calls to vserver"
     echo "vserver-options"
     echo "  all args after the optional -- are passed to vserver <name> build <options>"
@@ -486,14 +484,16 @@ function main () {
     esac
 
     VERBOSE=
+    RESISTANT=""
     IFNAME=""
     VSERVER_OPTIONS=""
-    while getopts "f:d:p:i:v" opt ; do
+    while getopts "f:d:p:i:rv" opt ; do
        case $opt in
            f) fcdistro=$OPTARG;;
            d) pldistro=$OPTARG;;
            p) personality=$OPTARG;;
            i) IFNAME=$OPTARG;;
+           r) RESISTANT="true";;
            v) VERBOSE="-v" ;;
            *) usage ;;
        esac
@@ -536,6 +536,10 @@ function main () {
     devel_or_vtest_tools $vserver $fcdistro $pldistro $personality
     post_install $vserver $personality
 
+    # Start Vserver automatically on boot
+    [ -n "$RESISTANt" ] && echo "default" > /etc/vservers/$vserver/apps/init/mark
+
+    echo $COMMAND Done
 }
 
 main "$@"