Skip to content

Commit b714637

Browse files
Merge pull request rudolfochrist#7 from bo-tato/install-script
Install script
2 parents 8a2f999 + f32489e commit b714637

3 files changed

Lines changed: 80 additions & 2 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,19 @@ ql-https — HTTPS support for Quicklisp via curl
2424
- curl (refer to your system package manager)
2525

2626

27-
## INSTALLATION
27+
## AUTOMATIC INSTALLATION
28+
29+
The default implementation is sbcl, if you are using another then set the `LISP`
30+
environment variable, for example to use Clozure common lisp:
31+
32+
export LISP=ccl
33+
34+
now run the installer script:
35+
36+
curl https://raw.githubusercontent.com/rudolfochrist/ql-https/master/install.sh | bash
37+
38+
39+
## MANUAL INSTALLATION
2840

2941
1. `mkdir ~/quicklisp` and `cd ~/quicklisp`
3042
2. Go to <https://beta.quicklisp.org/client/quicklisp.sexp> and lookup `:client-tar` URL, download it, verify

doc/README.org

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@ cat ../version
2525
- [[https://www.quicklisp.org/beta/][Quicklisp]]
2626
- curl (refer to your system package manager)
2727

28-
** INSTALLATION
28+
** AUTOMATIC INSTALLATION
29+
The default implementation is sbcl, if you are using another then set the ~LISP~
30+
environment variable, for example to use Clozure common lisp:
31+
#+begin_src sh
32+
export LISP=ccl
33+
#+end_src
34+
now run the installer script:
35+
#+begin_src sh
36+
curl https://raw.githubusercontent.com/rudolfochrist/ql-https/master/install.sh | bash
37+
#+end_src
38+
39+
** MANUAL INSTALLATION
2940

3041
1. =mkdir ~/quicklisp= and =cd ~/quicklisp=
3142
2. Go to [[https://beta.quicklisp.org/client/quicklisp.sexp]] and lookup =:client-tar= URL, download it, verify

install.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
LISP=${LISP=sbcl}
6+
7+
echo "Downloading quicklisp metadata..."
8+
mkdir -p ~/quicklisp
9+
meta=$( curl -s https://beta.quicklisp.org/client/quicklisp.sexp | \
10+
awk '/:client-tar/,/)/' | tr '\n' ' ' | sed -e's/\s\+/ /g' )
11+
12+
url=$( grep -oP '(?<=:url ")[^"]*' <<< "$meta" )
13+
sha256=$( grep -oP '(?<=:sha256 ")[^"]*' <<< "$meta" )
14+
15+
echo "Downloading quicklisp client..."
16+
curl -s "$url" -o ~/quicklisp/quicklisp.tar
17+
18+
if [ "$sha256" != "$(sha256sum ~/quicklisp/quicklisp.tar | cut -d' ' -f 1)" ]
19+
then
20+
echo "sha mismatch" >&2
21+
exit 1
22+
fi
23+
24+
tar xf ~/quicklisp/quicklisp.tar -C ~/quicklisp
25+
rm ~/quicklisp/quicklisp.tar
26+
27+
echo "Cloning ql-https..."
28+
git clone https://github.com/rudolfochrist/ql-https ~/common-lisp/ql-https
29+
30+
echo "Running setup code..."
31+
$LISP <<EOF
32+
(require 'asdf)
33+
(load "~/common-lisp/ql-https/ql-setup.lisp")
34+
(asdf:load-system "ql-https")
35+
(assert (equalp ql-http:*fetch-scheme-functions* '(("http" . ql-https:fetcher) ("https" . ql-https:fetcher))))
36+
(setf ql-https:*quietly-use-https* t)
37+
(quicklisp:setup)
38+
(ql-util:without-prompting
39+
(ql:add-to-init-file))
40+
EOF
41+
42+
cat > ~/quicklisp/setup.lisp <<EOF
43+
(require 'asdf)
44+
(let ((quicklisp-init #p"~/common-lisp/ql-https/ql-setup.lisp"))
45+
(when (probe-file quicklisp-init)
46+
(load quicklisp-init)
47+
(asdf:load-system "ql-https")
48+
(uiop:symbol-call :quicklisp :setup)))
49+
50+
;; optional
51+
#+ql-https
52+
(setf ql-https:*quietly-use-https* t)
53+
EOF
54+
55+
echo "All done!"

0 commit comments

Comments
 (0)