+chmod 0000 "$__DEFAULT_VSERVERDIR"
+setattr --barrier "$__DEFAULT_VSERVERDIR"
+
+# Build reference images for system slices
+for systemvserver in "$__DEFAULT_VSERVERDIR/.vstub/"*.cloned ; do
+ NAME=$(basename $systemvserver .cloned)
+
+ # Copy base reference image
+ if [ ! -d "$__DEFAULT_VSERVERDIR/.vref/$NAME" ] ; then
+ echo -n $"Building VServer reference image for $NAME: " >&3 2>&4
+
+ # Build in temporary directory
+ mkdir -p "$__DEFAULT_VSERVERDIR/.vtmp"
+ TMP=$(mktemp -d "$__DEFAULT_VSERVERDIR/.vtmp/$NAME.XXXXXX")
+ mkdir -p "$__DEFAULT_VSERVERDIR/.vref"
+
+ # build the systemvserver from the one it was originally cloned from
+ TYPE=$(cat $systemvserver)
+ REF="$__DEFAULT_VSERVERDIR/.vref/$TYPE"
+ "$_VCLONE" "$REF"/ "$TMP"/
+ RETVAL=$?
+
+ # merge the stub with the reference to get the system vserver
+ if [ $RETVAL -eq 0 ] ; then
+ (cd "$__DEFAULT_VSERVERDIR/.vstub/$NAME"/ && find . | cpio -m -d -u -p "$TMP"/)
+ RETVAL=$?
+ fi
+
+ # Clean RPM state
+ rm -f "$TMP/var/lib/rpm/__db"*
+
+ # Move it to its permanent location when complete
+ if [ $RETVAL -eq 0 ] ; then
+ mv "$TMP" "$__DEFAULT_VSERVERDIR/.vref/$NAME"
+ success >&3 2>&4
+ else
+ failure >&3 2>&4
+ fi
+ echo >&3 2>&4
+ fi
+done
+
+echo -n $"Updating VServer reference images: " >&3 2>&4