Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active February 10, 2019 19:38
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/0758569f0f1427f7b309c8145359ab35 to your computer and use it in GitHub Desktop.
Save cellularmitosis/0758569f0f1427f7b309c8145359ab35 to your computer and use it in GitHub Desktop.
Install clojure on Debian jessie (8)
#!/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
# setup jessie-backports
if ! grep -r jessie-backports /etc/apt/ >/dev/null; then
echo 'deb http://ftp.debian.org/debian jessie-backports main' >> /etc/apt/sources.list
apt-get update
fi
# install java 8
if ! dpkg -l | grep 8-jdk >/dev/null ; then
apt-get -y -t jessie-backports 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