-rm -rf "$VROOTDIR/.vtmp"
-
-mkdir -p "$VROOTDIR/.vcache"
-mkdir -p "$VROOTDIR/.vtmp"
-
-# loop forever
-while : ; do
- [ $debug -ne 0 ] && echo "$(date) Checking the cache"
- for i in $(seq 0 $(($slots - 1))) ; do
- if [ ! -d "$VROOTDIR/.vcache/v$i" ] ; then
- echo "$(date) Caching v$i"
- # build image in .vtmp
- TMP=$(mktemp -d "$VROOTDIR/.vtmp/v$i.XXXXXX")
- "$PKGLIBDIR/vbuild" "$VROOTDIR/vserver-reference" "$TMP"
- RETVAL=$?
- # move it to .vcache when complete
- if [ $RETVAL -eq 0 ] ; then
- # sanity check
- vnewsize=$(du -s "$TMP" | awk "{ print \$1 }")
- vrefsize=$(du -s "$VROOTDIR/vserver-reference" | awk "{ print \$1 }")
- if [ $vnewsize -lt $vrefsize ] ; then
- echo "WARNING: Unexpected for 'du -s $VROOTDIR/$NAME'=$vnewsize to be less than 'du -s $VROOTDIR/vserver-reference'=$vrefsize"
- fi
-
- mv "$TMP" "$VROOTDIR/.vcache/v$i"
- echo "$(date) v$i ready"
- else
- echo "$(date) Error $RETVAL building v$i"
- rm -rf "$TMP"
- fi
+rm -rf "$__DEFAULT_VSERVERDIR/.vtmp"
+
+mkdir -p "$__DEFAULT_VSERVERDIR/.vcache"
+mkdir -p "$__DEFAULT_VSERVERDIR/.vtmp"
+
+[ $debug -ne 0 ] && echo "$(date) Checking the cache"
+for i in $(seq 0 $(($slots - 1))) ; do
+ if [ ! -d "$__DEFAULT_VSERVERDIR/.vcache/v$i" ] ; then
+ echo "$(date) Caching v$i"
+ # build image in .vtmp
+ TMP=$(mktemp -d "$__DEFAULT_VSERVERDIR/.vtmp/v$i.XXXXXX")
+ "$_VCLONE" "$__DEFAULT_VSERVERDIR/.vref/default/" "$TMP"/
+ RETVAL=$?
+ # move it to .vcache when complete
+ if [ $RETVAL -eq 0 ] ; then
+ mv "$TMP" "$__DEFAULT_VSERVERDIR/.vcache/v$i"
+ echo "$(date) v$i ready"
+ else
+ echo "$(date) Error $RETVAL building v$i"
+ rm -rf "$TMP"