-patch /opt/clean/etc/IDEEnvs <<EOPATCH
---- IDEEnvs 2018-12-17 11:58:48.876039159 +0100
-+++ IDEEnvs 2018-12-17 12:00:52.384066455 +0100
-@@ -35,13 +35,44 @@
- Path: {Application}/lib/StdEnv
- Path: {Application}/lib/Dynamics
- Path: {Application}/lib/TCPIP
-+ Path: {Application}/lib/Gast
- Path: {Application}/lib/Platform
- Path: {Application}/lib/Platform/Deprecated/Generics
-+ Path: {Application}/lib/Platform/Deprecated/ArgEnv
-+ Path: {Application}/lib/Platform/Deprecated/MersenneTwister
- Path: {Application}/lib/Platform/Deprecated/StdLib
- Path: {Application}/lib/Sapl
- Path: {Application}/lib/GraphCopy
- Path: {Application}/lib/iTasks
-- EnvironmentCompiler: lib/exe/cocl::-dynamics -sapl
-+ EnvironmentCompiler: lib/exe/cocl:-h 500m -s 20m:-dynamics -sapl
-+ EnvironmentCodeGen: lib/exe/cg
-+ EnvironmentLinker: lib/exe/linker|lib/exe/sapl-collector-linker|lib/exe/itasks-web-collector
-+ EnvironmentDynLink: lib/exe/linker
-+ EnvironmentVersion: 920
-+ EnvironmentRedirect: False
-+ EnvironmentCompileMethod: Pers
-+ EnvironmentProcessor: I386
-+ Environment64BitProcessor: True
-+ Environment
-+ EnvironmentName: iTasks-git
-+ EnvironmentPaths
-+ Path: {Application}/lib/StdEnv
-+ Path: {Application}/lib/Dynamics
-+ Path: {Application}/lib/TCPIP
-+ Path: {Application}/lib/Sapl
-+ Path: {Application}/lib/GraphCopy
-+ Path: {Application}/lib/Gast
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/Platform-x86
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Posix
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Linux
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Linux-64
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/Generics
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/StdLib
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/ArgEnv
-+ Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/MersenneTwister
-+ Path: /home/mrl/projects/clean/iTasks-SDK/Libraries
-+ EnvironmentCompiler: lib/exe/cocl:-h 500m -s 20m:-dynamics -sapl
- EnvironmentCodeGen: lib/exe/cg
- EnvironmentLinker: lib/exe/linker|lib/exe/sapl-collector-linker|lib/exe/itasks-web-collector
- EnvironmentDynLink: lib/exe/linker
-EOPATCH
+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