scsh-install-lib/test/fetch-test-packages.scm

47 lines
1.5 KiB
Scheme
Executable File

#!/bin/sh
exec scsh -o thread-fluids -s "$0" "$@"
!#
;; Fetch (via HTTP) the various packages needed to test the
;; installation library. Requires either curl or wget.
(define pkg-dir "pkgs")
(define pkgs
'(("http://savannah.nongnu.org/download/sunterlib/" .
"sunterlib-0.7.tar.gz")
("ftp://ftp.scsh.net/pub/scsh/packages/scx/" .
"scx-0.2.tar.gz")
("ftp://ftp.scsh.net/pub/scsh/packages/scsh-expect/" .
"scsh-expect-0.1.tar.gz")
("ftp://ftp.scsh.net/pub/scsh/packages/sunet/" .
"sunet-2.1.tar.gz")
("ftp://ftp.scsh.net/pub/scsh/packages/scsh-yp/" .
"scsh-yp-0.2.tar.gz")
("ftp://ftp.scsh.net/pub/scsh/packages/orion-wm/" .
"orion-0.2.tar.gz")))
(define fetch-url
(let ((path (thread-fluid exec-path-list)))
(cond ((exec-path-search "curl" path)
(lambda (url) (run (curl --silent --remote-name ,url))))
((exec-path-search "wget" path)
(lambda (url) (run (wget --passive-ftp --quiet ,url))))
(else
(error "this script needs either curl or wget to work...")))))
(if (file-not-exists? pkg-dir)
(create-directory pkg-dir))
(for-each
(lambda (pkg)
(let ((pkg-url (car pkg))
(pkg-file (cdr pkg)))
(if (file-not-exists? (absolute-file-name pkg-file pkg-dir))
(begin
(format #t "Fetching ~a..." pkg-file)
(with-cwd pkg-dir
(fetch-url (string-append pkg-url pkg-file)))
(format #t "done\n")))))
pkgs)