diff --git a/basis/bootstrap/image/download/download.factor b/basis/bootstrap/image/download/download.factor index e2de621984..3a1abb3b2d 100644 --- a/basis/bootstrap/image/download/download.factor +++ b/basis/bootstrap/image/download/download.factor @@ -18,20 +18,19 @@ CONSTANT: url URL" http://factorcode.org/images/latest/" bi = not ] [ drop t ] if ; -: download-image ( arch -- ) - url swap boot-image-name >url derive-url download ; +: verify-image ( image -- ) + need-new-image? [ "Boot image corrupt" throw ] when ; -: maybe-download-image ( arch -- ) - dup boot-image-name need-new-image? [ - dup download-image - need-new-image? [ - "Boot image corrupt, or checksums.txt on server out of date" throw - ] when - ] [ - "Boot image up to date" print - drop - ] if ; +: download-image ( image -- ) + [ url swap >url derive-url download ] + [ verify-image ] + bi ; -: download-my-image ( -- ) my-arch maybe-download-image ; +: maybe-download-image ( image -- ? ) + dup need-new-image? + [ download-image t ] [ drop f ] if ; + +: download-my-image ( -- ) + my-arch boot-image-name maybe-download-image drop ; MAIN: download-my-image diff --git a/extra/mason/updates/updates.factor b/extra/mason/updates/updates.factor index b3f6847c35..60a155eae7 100644 --- a/extra/mason/updates/updates.factor +++ b/extra/mason/updates/updates.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov. +! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel io.launcher bootstrap.image.download mason.common mason.platform ; @@ -20,8 +20,7 @@ IN: mason.updates = not ; : new-image-available? ( -- ? ) - boot-image-name need-new-image? - [ boot-image-arch download-image t ] [ f ] if ; + boot-image-name maybe-download-image ; : new-code-available? ( -- ? ) updates-available?