Joe Groff 2010-05-25 18:40:58 -07:00
commit b60f8482e5
2 changed files with 14 additions and 16 deletions

View File

@ -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

View File

@ -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?