-chattr -R -i "$VROOTDIR/.vtmp"
-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
- mv "$TMP" "$VROOTDIR/.vcache/v$i"
- echo "$(date) v$i ready"
- else
- echo "$(date) Error $RETVAL building v$i"
- chattr -R -i "$TMP"
- 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"