| 
									
										
										
										
											2008-02-07 18:55:31 -05:00
										 |  |  | ! 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 | 
					
						
							| 
									
										
										
										
											2008-12-15 01:01:06 -05:00
										 |  |  | io.launcher math io.encodings.ascii io.files.temp io.pathnames | 
					
						
							|  |  |  | io.directories ;
 | 
					
						
							| 
									
										
										
										
											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
 | 
					
						
							|  |  |  |     "slava@factorcode.org:/var/www/factorcode.org/newsite/images/latest/" | 
					
						
							|  |  |  |     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
										 |  |  | 
 | 
					
						
							|  |  |  | : 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 ;
 | 
					
						
							| 
									
										
										
										
											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 |