prepare for new laptop
[dotfiles.git] / clean / .local / bin / install_clean.sh
index acf04f0..e9be47e 100755 (executable)
@@ -1,4 +1,31 @@
-#!/bin/sh
-mv /opt/clean /opt/clean.bak
-curl ftp://ftp.cs.ru.nl/pub/Clean/builds/linux-x64/clean-bundle-complete-linux-x64-latest.tgz | tar -xz
-mv clean-bundle-complete /opt/clean
+#!/bin/bash
+set -e
+
+if [ $# -ne 1 ]
+then
+       echo "Usage: $0 [x86|x64]"
+       exit 1
+fi
+
+DISTRO="https://ftp.cs.ru.nl/Clean/builds/linux-$1/clean-bundle-complete-linux-$1-latest.tgz"
+TAGS="https://gitlab.com/cloogle/periphery/cloogle-tags/-/jobs/artifacts/master/raw/cloogletags?job=build"
+CLMMAN="https://gitlab.science.ru.nl/clean-and-itasks/clm/raw/master/clm.1"
+CP2CG="https://gitlab.science.ru.nl/clean-and-itasks/cleanprof2callgrind/-/jobs/artifacts/master/raw/cleanprof2callgrind?job=test"
+CLEAN_HOME="/opt/clean-$1"
+
+echo "Cleaning up the old distro"
+rm -rf "$CLEAN_HOME"/*
+mkdir -p "$CLEAN_HOME"
+echo "Downloading clean"
+curl -ksSL "$DISTRO" | tar -C "$CLEAN_HOME" --strip-components=1 -xz
+echo "Installing manpages"
+mkdir -p ~/.local/man/man1
+curl -sSLo ~/.local/man/man1/clm.1 "$CLMMAN"
+echo "Downloading cleanprof2callgrind"
+curl -sSLo "$CLEAN_HOME/bin/cleanprof2callgrind" "$CP2CG"
+chmod +x "$CLEAN_HOME"/bin/cleanprof2callgrind
+echo "Downloading cloogletags"
+curl -sSLo "$CLEAN_HOME"/bin/cloogletags "$TAGS"
+chmod +x "$CLEAN_HOME"/bin/cloogletags
+echo "Generating tags"
+cloogletags -a -c -d "$CLEAN_HOME"/lib -o "$CLEAN_HOME"/lib/tags 2>/dev/null