 : build-loop ( -- )
   builds-check
   [
-    builds "/factor" append cd
-    updates-available? new-image-available? or
-      [ build ]
-    when
+    builds/factor
+      [
+        updates-available? new-image-available? or
+          [ build ]
+        when
+      ]
+    with-directory
   ]
-  failsafe
+  try
   5 minutes sleep
   build-loop ;
 


! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

: compress-image ( -- )
  { "bzip2" my-boot-image-name } to-strings run-process drop ;

: build ( -- )
  [ (build) ] failsafe
  builds cd stamp> cd
  [ send-builder-email ] [ drop "not sending mail" . ] recover
  { "rm" "-rf" "factor" } run-process drop
  [ compress-image ] failsafe ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

: copy-image ( -- )
  builds/factor my-boot-image-name append-path ".." copy-file-into
  builds/factor my-boot-image-name append-path "."  copy-file-into ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

