factor/basis/bootstrap/image/upload/upload.factor

42 lines
1.1 KiB
Factor
Raw Normal View History

! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2008-05-14 07:08:57 -04:00
USING: checksums checksums.openssl splitting assocs
2008-09-10 23:11:40 -04:00
kernel io.files bootstrap.image sequences io namespaces make
io.launcher math io.encodings.ascii io.files.temp io.pathnames
io.directories ;
IN: bootstrap.image.upload
SYMBOL: upload-images-destination
: destination ( -- dest )
upload-images-destination get
"slava_pestov@downloads.factorcode.org:downloads.factorcode.org/images/latest/"
or ;
: checksums ( -- temp ) "checksums.txt" temp-file ;
2008-02-26 15:58:16 -05:00
: boot-image-names ( -- seq ) images [ boot-image-name ] map ;
: compute-checksums ( -- )
checksums ascii [
2008-04-30 17:11:55 -04:00
boot-image-names [
2008-05-12 23:30:11 -04:00
[ write bl ]
[ openssl-md5 checksum-file hex-string print ]
bi
2008-04-30 17:11:55 -04:00
] each
] with-file-writer ;
: upload-images ( -- )
[
2008-02-26 16:22:39 -05:00
"scp" ,
boot-image-names %
"temp/checksums.txt" , destination ,
2008-02-08 22:15:29 -05:00
] { } make try-process ;
: new-images ( -- )
"" resource-path
[ make-images compute-checksums upload-images ]
with-directory ;
MAIN: new-images