annotate etc/setup_as_dml.sh @ 88:f3103f125c2d dml-dockerised

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