@@ -4,31 +4,43 @@ set -euo pipefail
44
55LISP=${LISP=sbcl}
66
7+ # For testers
8+ QL_TOPDIR=" ${QL_TOPDIR-$HOME / quicklisp} "
9+ CLDIR=" ${CLDIR-$HOME / common-lisp} "
10+ SKIP_USERINIT=" ${SKIP_USERINIT-no} "
11+
12+ if test -d " $QL_TOPDIR " ; then
13+ echo " Cannot install Quicklisp because it seems it is already installed!"
14+ echo " Please check $QL_TOPDIR "
15+ exit 1
16+ fi
17+
718echo " Downloading quicklisp metadata..."
8- mkdir -p ~ /quicklisp
19+ mkdir -p " $QL_TOPDIR "
920meta=$( curl -s https://beta.quicklisp.org/client/quicklisp.sexp | \
10- awk ' /:client-tar/,/)/' | tr ' \n' ' ' | sed -e ' s/\s\+/ /g ' )
21+ awk ' /:client-tar/,/)/' | tr ' \n' ' ' | tr -s ' ' )
1122
12- url=$( grep -oP ' (?<=:url ")[^"]*' <<< " $meta" )
13- sha256=$( grep -oP ' (?<=:sha256 ")[^"]*' <<< " $meta" )
23+ url=$( perl -nle ' print $& if m{ (?<=:url ")[^"]*}g ' <<< " $meta" )
24+ sha256=$( perl -nle ' print $& if m{ (?<=:sha256 ")[^"]*}g ' <<< " $meta" )
1425
1526echo " Downloading quicklisp client..."
16- curl -s " $url " -o ~ /quicklisp /quicklisp.tar
27+ curl -s " $url " -o " $QL_TOPDIR " /quicklisp.tar
1728
18- if [ " $sha256 " != " $( sha256sum ~ /quicklisp/quicklisp .tar | cut -d' ' -f 1 ) " ]
29+ if [ " $sha256 " != " $( openssl dgst -sha256 " $QL_TOPDIR " /quicklisp.tar | cut -d' ' -f 2 ) " ]
1930then
20- echo " sha mismatch" >&2
21- exit 1
31+ echo " sha mismatch" >&2
32+ exit 1
2233fi
2334
24- tar xf ~ /quicklisp/quicklisp .tar -C ~ /quicklisp
25- rm ~ /quicklisp /quicklisp.tar
35+ tar xf " $QL_TOPDIR " /quicklisp.tar -C " $QL_TOPDIR "
36+ rm " $QL_TOPDIR " /quicklisp.tar
2637
2738echo " Cloning ql-https..."
28- git clone https://github.com/rudolfochrist/ql-https ~ /common-lisp /ql-https
39+ git clone https://github.com/rudolfochrist/ql-https " $CLDIR " /ql-https
2940
30- echo " Running setup code..."
31- $LISP << EOF
41+ if test " $SKIP_USERINIT " = no; then
42+ echo " Running setup code..."
43+ $LISP << EOF
3244(require 'asdf)
3345(load "~/common-lisp/ql-https/ql-setup.lisp")
3446(asdf:load-system "ql-https")
@@ -39,7 +51,7 @@ $LISP <<EOF
3951 (ql:add-to-init-file))
4052EOF
4153
42- cat > ~ /quicklisp /setup.lisp << EOF
54+ cat > " $QL_TOPDIR " /setup.lisp << EOF
4355(require 'asdf)
4456(let ((quicklisp-init #p"~/common-lisp/ql-https/ql-setup.lisp"))
4557 (when (probe-file quicklisp-init)
@@ -51,5 +63,6 @@ cat > ~/quicklisp/setup.lisp <<EOF
5163#+ql-https
5264(setf ql-https:*quietly-use-https* t)
5365EOF
66+ fi
5467
5568echo " All done!"
0 commit comments