-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.rkt
33 lines (25 loc) · 905 Bytes
/
install.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#lang racket/base
(require launcher/launcher
racket/cmdline)
(define prefix-bin (make-parameter "/usr/local/bin"))
(command-line
#:program "staapl/install"
#:once-each
[("--prefix-bin") path "Where to link executables (default: /usr/local/bin)" (prefix-bin path)]
#:args () (void))
(define (overwrite-link src dst)
(when (file-exists? dst)
(delete-file dst))
(make-file-or-directory-link src dst)
(printf "linked: ~a -> ~a\n" dst src))
(define (install prog)
(let ((at (mzscheme-program-launcher-path prog)))
(make-mzscheme-launcher
`("-l" ,(format "staapl/~a" prog) "--") at)
(printf "installed: ~a\n" (path->string at))
(with-handlers ((void void)) ;; attempt.. might fail due to permissions
(case (system-type)
((unix macosx)
(overwrite-link at (format "~a/~a" (prefix-bin) prog)))
(else (void))))))
(install "staaplc")