Commit 04e7afde4ca500e764f33aad9c3ef10e3349652d

Thomas de Grivel 2020-03-28T11:50:25

install script

diff --git a/install-repo.sh b/install-repo.sh
new file mode 100755
index 0000000..7a15e66
--- /dev/null
+++ b/install-repo.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -e
+
+REPO_DIR=$HOME/common-lisp
+REPO_DIR=/tmp/common-lisp
+
+GITHUB='https://github.com/'
+
+# detect gnu make
+
+if which gmake; then
+    MAKE=gmake
+else
+    MAKE=make
+fi
+
+# clone git repo
+
+maybe_clone() {
+    HOST="$1"
+    OWNER="$2"
+    NAME="$3"
+    if ! [ -d "${REPO_DIR}/${OWNER}/${NAME}" ]; then
+        echo "Installing ${HOST}${OWNER}/${NAME} into ${REPO_DIR}/${OWNER}/${NAME}"
+        mkdir -p "${REPO_DIR}/${OWNER}"
+        git -C "${REPO_DIR}/${OWNER}" clone "${HOST}${OWNER}/${NAME}"
+    fi
+}
+
+# Install ASDF from Github
+
+maybe_clone "${GITHUB}" 'fare' 'asdf'
+"${MAKE}" -C "${REPO_DIR}/fare/asdf"
+
+# Install Repo from Github
+
+maybe_clone "${GITHUB}" 'common-lisp-repo' 'repo'
+
+# Configure SBCL
+
+{
+    echo "(load \"${REPO_DIR}/fare/asdf/build/asdf\")"
+    echo "(load \"${REPO_DIR}/common-lisp-repo/repo/repo\")"
+    echo "(repo:boot)"
+} >> ~/.sbclrc