diff --git a/.circleci/config.yml b/.circleci/config.yml index efa2a70e..efe27042 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,9 +28,7 @@ jobs: - run: name: Install Clojure command: | - wget -nc https://download.clojure.org/install/linux-install-1.10.1.447.sh - chmod +x linux-install-1.10.1.447.sh - sudo ./linux-install-1.10.1.447.sh + sudo script/install-clojure - run: name: Run JVM tests command: | @@ -91,9 +89,7 @@ jobs: - run: name: Install Clojure command: | - wget -nc https://download.clojure.org/install/linux-install-1.10.1.447.sh - chmod +x linux-install-1.10.1.447.sh - ./linux-install-1.10.1.447.sh + script/install-clojure - run: name: Install native dev tools command: | @@ -171,9 +167,7 @@ jobs: - run: name: Install Clojure command: | - wget -nc https://download.clojure.org/install/linux-install-1.10.1.447.sh - chmod +x linux-install-1.10.1.447.sh - ./linux-install-1.10.1.447.sh + script/install-clojure - run: name: Install native dev tools command: | @@ -247,9 +241,7 @@ jobs: - run: name: Install Clojure command: | - wget -nc https://download.clojure.org/install/linux-install-1.10.1.447.sh - chmod +x linux-install-1.10.1.447.sh - sudo ./linux-install-1.10.1.447.sh + sudo script/install-clojure - restore_cache: keys: - linux-aarch64-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} @@ -326,9 +318,7 @@ jobs: - run: name: Install Clojure command: | - wget -nc https://download.clojure.org/install/linux-install-1.10.1.447.sh - chmod +x linux-install-1.10.1.447.sh - sudo ./linux-install-1.10.1.447.sh + sudo script/install-clojure - restore_cache: keys: - linux-aarch64-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} @@ -397,7 +387,7 @@ jobs: - run: name: Install Clojure command: | - script/install-clojure /usr/local + script/install-clojure - run: name: Install Leiningen command: | diff --git a/script/install-clojure b/script/install-clojure index f4781ba1..138e483f 100755 --- a/script/install-clojure +++ b/script/install-clojure @@ -1,10 +1,14 @@ #!/usr/bin/env bash -install_dir=${1:-/usr/local} +set -euo pipefail + +CLOJURE_TOOLS_VERSION="1.10.1.447" + +install_dir="${1:-/usr/local}" mkdir -p "$install_dir" cd /tmp -curl -O -sL https://download.clojure.org/install/clojure-tools-1.10.1.447.tar.gz -tar xzf clojure-tools-1.10.1.447.tar.gz +curl -O -sL "https://download.clojure.org/install/clojure-tools-$CLOJURE_TOOLS_VERSION.tar.gz" +tar xzf "clojure-tools-$CLOJURE_TOOLS_VERSION.tar.gz" cd clojure-tools clojure_lib_dir="$install_dir/lib/clojure" mkdir -p "$clojure_lib_dir/libexec" @@ -18,6 +22,6 @@ cp clojure "$install_dir/bin" cp clj "$install_dir/bin" cd /tmp -rm -rf clojure-tools-1.10.1.447.tar.gz -rm -rf clojure-tools +rm -rf "clojure-tools-$CLOJURE_TOOLS_VERSION.tar.gz" +rm -rf "clojure-tools" echo "Installed clojure to $install_dir/bin"