2008-02-07 18:55:31 -05:00
|
|
|
! Copyright (C) 2008 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2015-02-05 16:43:49 -05:00
|
|
|
USING: bootstrap.image checksums checksums.openssl io
|
|
|
|
io.directories io.encodings.ascii io.files io.files.temp
|
|
|
|
io.launcher io.pathnames kernel make namespaces sequences system ;
|
2008-02-07 18:55:31 -05:00
|
|
|
IN: bootstrap.image.upload
|
|
|
|
|
2008-03-01 05:14:37 -05:00
|
|
|
SYMBOL: upload-images-destination
|
|
|
|
|
|
|
|
: destination ( -- dest )
|
2009-08-13 20:21:44 -04:00
|
|
|
upload-images-destination get
|
2010-09-27 23:29:09 -04:00
|
|
|
"slava_pestov@downloads.factorcode.org:downloads.factorcode.org/images/latest/"
|
2009-08-13 20:21:44 -04:00
|
|
|
or ;
|
2008-02-07 18:55:31 -05:00
|
|
|
|
2008-06-09 03:14:14 -04:00
|
|
|
: checksums ( -- temp ) "checksums.txt" temp-file ;
|
2008-02-26 15:58:16 -05:00
|
|
|
|
2008-06-09 03:14:14 -04:00
|
|
|
: boot-image-names ( -- seq ) images [ boot-image-name ] map ;
|
2008-02-07 18:55:31 -05:00
|
|
|
|
|
|
|
: compute-checksums ( -- )
|
2008-02-29 02:20:44 -05:00
|
|
|
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
|
2008-02-15 23:20:31 -05:00
|
|
|
] with-file-writer ;
|
2008-02-07 18:55:31 -05:00
|
|
|
|
2015-02-05 16:43:49 -05:00
|
|
|
! Windows scp doesn't like pathnames with colons, it treats them as hostnames.
|
|
|
|
! Workaround for uploading checksums.txt created with temp-file.
|
|
|
|
! e.g. C:\Users\\Doug\\AppData\\Local\\Temp/factorcode.org\\Factor/checksums.txt
|
|
|
|
! ssh: Could not resolve hostname c: no address associated with name
|
|
|
|
|
|
|
|
HOOK: scp-name os ( -- path )
|
|
|
|
M: object scp-name "scp" ;
|
|
|
|
M: windows scp-name "pscp" ;
|
|
|
|
|
2008-02-07 18:55:31 -05:00
|
|
|
: upload-images ( -- )
|
|
|
|
[
|
2015-02-05 16:43:49 -05:00
|
|
|
\ scp-name get-global scp-name or ,
|
2008-02-26 16:22:39 -05:00
|
|
|
boot-image-names %
|
2012-04-17 23:49:19 -04:00
|
|
|
checksums , destination ,
|
2008-02-08 22:15:29 -05:00
|
|
|
] { } make try-process ;
|
2008-02-07 18:55:31 -05:00
|
|
|
|
|
|
|
: new-images ( -- )
|
2008-03-01 05:14:37 -05:00
|
|
|
"" resource-path
|
|
|
|
[ make-images compute-checksums upload-images ]
|
|
|
|
with-directory ;
|
2008-02-07 18:55:31 -05:00
|
|
|
|
|
|
|
MAIN: new-images
|