Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active October 17, 2019 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellularmitosis/2907c226218d3c4cca70f5f658074d31 to your computer and use it in GitHub Desktop.
Save cellularmitosis/2907c226218d3c4cca70f5f658074d31 to your computer and use it in GitHub Desktop.
Install clojure on Debian stretch (9)
#!/bin/bash
set -e -o pipefail
set -x
# remove any debian version of clojure
if dpkg -l | grep '^ii' | awk '{print $2}' | grep clojure >/dev/null; then
apt-get -y remove '.*clojure.*'
fi
# install java 8
if ! dpkg -l | grep 8-jdk >/dev/null ; then
apt-get -y install openjdk-8-jdk
fi
# make java 8 the default
if ! java -version 2>&1 | head -n1 | grep '1\.8' >/dev/null; then
update-java-alternatives -s $( update-java-alternatives -l | awk '{print $1}' | grep '1\.8' )
fi
# install clojure
install="no"
if ! which clojure >/dev/null; then
install="yes"
elif ! cat `which clojure` | grep '1\.10' >/dev/null; then
install="yes"
fi
if [ "$install" = "yes" ]; then
apt-get -y install curl rlwrap
cd /tmp
curl -O https://download.clojure.org/install/linux-install-1.10.0.411.sh
chmod +x linux-install-1.10.0.411.sh
./linux-install-1.10.0.411.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment