-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·69 lines (55 loc) · 1.84 KB
/
install.sh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
set -euo pipefail
LISP=${LISP=sbcl}
# For testers
QL_TOPDIR="${QL_TOPDIR-$HOME/quicklisp}"
CLDIR="${CLDIR-$HOME/common-lisp}"
SKIP_USERINIT="${SKIP_USERINIT-no}"
if test -d "$QL_TOPDIR"; then
echo "Cannot install Quicklisp because it seems it is already installed!"
echo "Please check $QL_TOPDIR"
exit 1
fi
echo "Downloading quicklisp metadata..."
mkdir -p "$QL_TOPDIR"
meta=$( curl -s https://beta.quicklisp.org/client/quicklisp.sexp | \
awk '/:client-tar/,/)/' | tr '\n' ' ' | tr -s ' ' )
url=$( perl -nle 'print $& if m{(?<=:url ")[^"]*}g' <<< "$meta" )
[[ "$url" =~ ^http:// ]] && url="https${url#http}"
sha256=$( perl -nle 'print $& if m{(?<=:sha256 ")[^"]*}g' <<< "$meta" )
echo "Downloading quicklisp client..."
curl -s "$url" -o "$QL_TOPDIR"/quicklisp.tar
if [ "$sha256" != "$(openssl dgst -sha256 "$QL_TOPDIR"/quicklisp.tar | cut -d' ' -f 2)" ]
then
echo "sha mismatch" >&2
exit 1
fi
tar xf "$QL_TOPDIR"/quicklisp.tar -C "$QL_TOPDIR"
rm "$QL_TOPDIR"/quicklisp.tar
echo "Cloning ql-https..."
git clone https://github.com/rudolfochrist/ql-https "$CLDIR"/ql-https
if test "$SKIP_USERINIT" = no; then
echo "Running setup code..."
$LISP <<EOF
(require 'asdf)
(load "~/common-lisp/ql-https/ql-setup.lisp")
(asdf:load-system "ql-https")
(assert (equalp ql-http:*fetch-scheme-functions* '(("http" . ql-https:fetcher) ("https" . ql-https:fetcher))))
(setf ql-https:*quietly-use-https* t)
(quicklisp:setup)
(ql-util:without-prompting
(ql:add-to-init-file))
EOF
cat > "$QL_TOPDIR"/setup.lisp <<EOF
(require 'asdf)
(let ((quicklisp-init #p"~/common-lisp/ql-https/ql-setup.lisp"))
(when (probe-file quicklisp-init)
(load quicklisp-init)
(asdf:load-system "ql-https")
(uiop:symbol-call :quicklisp :setup)))
;; optional
#+ql-https
(setf ql-https:*quietly-use-https* t)
EOF
fi
echo "All done!"