annotate etc/setup_as_dml.sh @ 13:2059c4f64feb

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