annotate etc/setup_as_dml.sh @ 14:0dcb52a3722e

Simplifying install process, in progress.
author samer
date Fri, 23 Jan 2015 17:09:31 +0000
parents 43c065ae6852
children ef88a4afac7a
rev   line source
samer@0 1 #!/bin/sh
samer@9 2 # ------------------ CONFIG ----------------
samer@0 3
samer@9 4 INSTALL_SWI=no
samer@11 5 SS_USER=samer
samer@11 6 MAKE_HUMDRUM=no
samer@11 7
samer@14 8 if [ -x matlab ]; then
samer@14 9 HAVE_MATLAB=yes
samer@14 10 else
samer@14 11 HAVE_MATLAB=no
samer@14 12 fi
samer@14 13
samer@11 14 # ------------------ END OF CONFIG ---------
samer@0 15
samer@3 16 function install_swi {
samer@11 17 # cd ~/downloads
samer@11 18 # wget http://www.swi-prolog.org/download/devel/src/pl-7.1.29.tar.gz
samer@11 19 # cd ~/src
samer@11 20 # tar xzf pl-7.1.29.tar.gz
samer@9 21 unpack_into ~/src http://www.swi-prolog.org/download/devel/src/pl-7.1.29.tar.gz
samer@9 22 cd ~/src/pl-7.1.29
samer@3 23 cp build.templ build
samer@3 24 patch build ~/etc/swipl-build.patch
samer@3 25 ./build
samer@3 26 }
samer@3 27
samer@9 28 function unpack_into {
samer@9 29 arname=$(basename "$2")
samer@11 30 wget_into ~/downloads "$2" && cd "$1" && tar xzf ~/downloads/$arname
samer@11 31 }
samer@11 32
samer@11 33 function cp_into {
samer@11 34 name=$(basename "$2")
samer@11 35 mkdir -p "$1"
samer@11 36 wget_into ~/downloads "$2" && cp -p "$name" "$1"
samer@9 37 }
samer@0 38
samer@9 39 function wget_into {
samer@11 40 name=$(basename "$2")
samer@9 41 mkdir -p "$1"
samer@9 42 cd "$1"
samer@11 43 if [ -a "$name" ]; then
samer@11 44 echo "Aready existing in $1: $2."
samer@11 45 else
samer@11 46 echo "I am going to download into $1 from $2."
samer@11 47 echo "You may be asked for a password."
samer@11 48 wget --user=$SS_USER --ask-password "$2"
samer@11 49 fi
samer@9 50 }
samer@9 51
samer@9 52 function get_repo_into {
samer@9 53 dest="$1"
samer@9 54 repo="$3"
samer@9 55 cmd=$2
samer@9 56 shift 3
samer@9 57
samer@9 58 name=$(basename "$repo")
samer@11 59 mkdir -p "$dest"
samer@9 60 cd "$dest"
samer@9 61 if [ -d $name ]; then
samer@9 62 echo "$name repository alread present in $dest"
samer@9 63 else
samer@9 64 $cmd clone "$repo" $*
samer@9 65 fi
samer@9 66 }
samer@9 67
samer@9 68 if [ $INSTALL_SWI == yes ]; then
samer@9 69 install_swi
samer@9 70 fi
samer@0 71
samer@14 72 if [ $INSTALL_SWI_PACKS == yes ]; then
samer@14 73 swipl -g 'maplist(pack_install,[lambda,prosqlite,memo,callgraph,swipe,sparkle,musicbrainz,plsmf,plumdrum,sindice]), halt'
samer@14 74 if [ $HAVE_MATLAB == yes ]; then
samer@14 75 swipl -g 'pack_install(plml), halt'
samer@14 76 end
samer@14 77 fi
samer@14 78
samer@0 79 # DOWNLOADS FROM REPOs
samer@11 80 get_repo_into ~/src/github git https://github.com/samer--/ClioPatria
samer@9 81 get_repo_into ~/src/github git https://github.com/humdrum-tools/humdrum-tools --recursive
samer@11 82 if [ $MAKE_HUMDRUM == yes ]; then
samer@11 83 cd ~/src/github/humdrum-tools && make
samer@11 84 fi
samer@11 85
samer@9 86 get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-cliopatria
samer@9 87 get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/ishara
samer@9 88 get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/kernscores-utf8
samer@14 89 get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-datasets
samer@0 90
samer@11 91 cp_into ~/lib/beets https://code.soundsoftware.ac.uk/attachments/download/1284/music-ro.db
samer@3 92
samer@11 93 mkdir -p ~/var/dml/memo_db