Make it easier to add rsync arguments.
[util-vserver.git] / scripts / vserver-build.functions
index b56a353..7e26efd 100644 (file)
@@ -44,6 +44,9 @@ function makeDevEntry
        (f)     touch "$dst"
                chmod $4 "$dst"
                ;;
+       (l)     ln -s "$4" "$dst"
+               test -z "$5" || chmod "$5" "$dst"
+               ;;
        (*)     echo "Unknown dev-entry mode '$3'" >&2
                false
                ;;
@@ -54,7 +57,8 @@ function populateDev
 {
     local spec
 
-    mkdir -p -m755 "$VDIR"/dev/pts
+    mkdir -p -m755 "$VDIR"/dev
+    mkdir -m755 "$VDIR"/dev/pts
 
     while read spec; do
        makeDevEntry "$VDIR"/dev $spec
@@ -202,6 +206,9 @@ exist already; please try to use '--force', or remove them manually."
 
     mkdir -p -m755 "$VDIR"
     $_SETATTR --~barrier "$VDIR"
+    $_SETATTR --barrier "$VDIR"/.. || colwarn $"\
+WARNING: could not set the barrier attribute on '$VDIR/..',
+         please set it manually."
     base._addGeneratedFile "$VDIR"
     
     mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/etc
@@ -260,12 +267,16 @@ function base.setSuccess
 function startSleepingGuest
 {
     local guest="$1"
-    local timeout="$2"
+    local timeout="${2:-15}"
     $_VSERVER "$guest" start --rescue --rescue-init bash -c "
        exec  > /dev/null
        exec 2> /dev/null
        trap 'kill -s 9 -- -1; exit 0' INT
-       sleep $timeout
+       i=0
+       while [ \$i -lt $timeout ]; do
+           sleep 1
+           let ++i
+       done
        kill -s 15 -- -1
        sleep 1
        kill -s 9 -- -1"
@@ -274,5 +285,5 @@ function startSleepingGuest
 function stopSleepingGuest
 {
     local guest="$1"
-    $_VKILL --xid "$guest" -s INT -- 1
+    $_VSERVER "$guest" stop --rescue-init
 }