Mercurial > hg > dtl-dml-home
changeset 11:43c065ae6852
Fixes to setup_as_dml and more docs
author | samer |
---|---|
date | Sun, 18 Jan 2015 23:24:43 +0000 |
parents | 0eba4de3988f |
children | 4bf4943f93a4 0dcb52a3722e |
files | etc/INSTALL etc/setup_as_dml.sh lib/kern |
diffstat | 3 files changed, 118 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/INSTALL Sun Jan 18 23:24:43 2015 +0000 @@ -0,0 +1,85 @@ +h1. Server setup instructions v2 + +These instructions assume a Debian-based Linux distribution, and a user account called 'dml'. + +Also, please add any environment variables needed for internet proxy settings etc in the system-wide shell profile. + +If you are using Ubuntu, I recommend the following modification to the file /etc/sudoers: at the prompt, say <code>sudo visudo</code> and add the following to the 'Defaults' section near the top: +<pre> +Defaults env_keep -= "HOME" +</pre> + +This means that when you use sudo, the given command will run with the HOME environment variable set to root's home, ie /root, instead +of the user's home. This is the default on Debian, and IMHO it makes more sense, and avoids doing bizarre rooty things in the unsuspecting +user's home directory. It also means that <code>sudo bash</code> or <code>sudo -s</code> give you a root shell with root's bash profile +and bashrc. + +Finally, if you add the following near the end of /root/.bashrc, a root shell will have a nice red prompt to remind you of it's +awesome power: +<pre> +PS1='\[\e[1;31m\]\t ${debian_chroot:+($debian_chroot)}\u@\h:\w#\[\e[0m\] ' +</pre> + +h2. Home directory setup + +The dml home directory can be prepared by cloning the dml-home repository on this server. Note that you can only clone into an empty directory, so doing this when the dml home directory already exists is a bit of a fiddly job--you'd have to clone the repository +somewhere else and then copy it over the existing home directory. +<pre> +sudo apt-get install mercurial +cd /tmp +hg clone https://code.soundsoftware.ac.uk/hg/dml-home +cp -pR dml-home /home/dml +</pre> + +Alternatively, you can download the archive from https://code.soundsoftware.ac.uk/attachments/download/1286/dml-home-0.0.1.tar.gz, +put it in the dml home directory, and unpack it in place: +<pre> +cd +tar xzf dml-home.tar.gz +</pre> + +After doing this, log out and log back in again as dml to pick up the new bash profile, bashrc etc. + +h2. Install MATLAB + +If you have a license, now is the time to install Matlab. The current DML ClioPatria component does not react well to the absence of Matlab, but in future, it will be reorganised so that the Matlab sub-component will be an optional plug-in. + +h2. Setup as root + +The directory ~/etc contains a shell script setup_as_root.sh. Before you run this, edit it to set the variables +defined in the configuration section at the top. Then run it using sudo: +<pre> +sudo sh setup_as_root.sh +</pre> +This will install various packages via apt-get, make some links in the file system, configure Matlab (if enabled) +and configure the X server. + +h2. Setup as dml user + +The script ~/etc/setup_as_dml.sh contains commands to do nearly everything else. +It will clone the following repositories: +* A modified fork of ClioPatria from GitHub: https://github.com/samer--/ClioPatria +* Humdrum tools from GitHub https://github.com/humdrum-tools/humdrum.git +* DML ClioPatria package from dml-cliopatria +* Matlab utilities from ishara +* Kern scores from kernscores-utf8 + +Then (in theory) it will download some archives from this site: +# https://code.soundsoftware.ac.uk/attachments/download/1283/DML_metadata_batch_01.tar.gz +# https://code.soundsoftware.ac.uk/attachments/download/1284/music-ro.db +# https://code.soundsoftware.ac.uk/attachments/download/1282/var-dml-cpack.tar.gz +# https://code.soundsoftware.ac.uk/attachments/download/1281/lib-swipl.tar.gz + +However, in practise, access restrictions mean that this seems not to work. +If they cannot be downloaded automatically, download them manually, put them in ~/downloads, +and run the script again. + +The alternative to step 4 is to build the packs from within SWI Prolog: +<pre> +?- maplist(pack_install,[memo,callgraph,swipe,sparkle,lambda,musicbrainz,plml,plsmf,plumdrum,prosqlite,sindice]). +</pre> + +h2. Downloading sound fonts + +The only remaining job is to download some soundfonts to resolve the links in ~/lib/sounds/sf2. +
--- a/etc/setup_as_dml.sh Sun Jan 18 21:58:27 2015 +0000 +++ b/etc/setup_as_dml.sh Sun Jan 18 23:24:43 2015 +0000 @@ -1,10 +1,17 @@ #!/bin/sh # ------------------ CONFIG ---------------- -CLEANUP=no INSTALL_SWI=no +SS_USER=samer +MAKE_HUMDRUM=no + +# ------------------ END OF CONFIG --------- function install_swi { + # cd ~/downloads + # wget http://www.swi-prolog.org/download/devel/src/pl-7.1.29.tar.gz + # cd ~/src + # tar xzf pl-7.1.29.tar.gz unpack_into ~/src http://www.swi-prolog.org/download/devel/src/pl-7.1.29.tar.gz cd ~/src/pl-7.1.29 cp build.templ build @@ -13,19 +20,27 @@ } function unpack_into { - wget_into ~/downloads "$2" arname=$(basename "$2") - cd "$1" - tar xzf "~/downloads/$arname" - if [ $CLEANUP == yes ]; then - rm "~/downloads/$arname" - fi + wget_into ~/downloads "$2" && cd "$1" && tar xzf ~/downloads/$arname +} + +function cp_into { + name=$(basename "$2") + mkdir -p "$1" + wget_into ~/downloads "$2" && cp -p "$name" "$1" } function wget_into { + name=$(basename "$2") mkdir -p "$1" cd "$1" - wget "$2" + if [ -a "$name" ]; then + echo "Aready existing in $1: $2." + else + echo "I am going to download into $1 from $2." + echo "You may be asked for a password." + wget --user=$SS_USER --ask-password "$2" + fi } function get_repo_into { @@ -35,6 +50,7 @@ shift 3 name=$(basename "$repo") + mkdir -p "$dest" cd "$dest" if [ -d $name ]; then echo "$name repository alread present in $dest" @@ -48,18 +64,19 @@ fi # DOWNLOADS FROM REPOs -get_repo_into ~/src/github git https://samer--/ClioPatria +get_repo_into ~/src/github git https://github.com/samer--/ClioPatria get_repo_into ~/src/github git https://github.com/humdrum-tools/humdrum-tools --recursive +if [ $MAKE_HUMDRUM == yes ]; then + cd ~/src/github/humdrum-tools && make +fi + get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/dml-cliopatria get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/ishara get_repo_into ~/src/hg hg https://code.soundsoftware.ac.uk/hg/kernscores-utf8 -ln -s ~/src/hg/kernscores-utf8 ~/lib/kern - unpack_into ~/lib https://code.soundsoftware.ac.uk/attachments/download/1281/lib-swipl.tar.gz unpack_into ~/var/dml https://code.soundsoftware.ac.uk/attachments/download/1282/var-dml-cpack.tar.gz -wget_into ~/lib/beets https://code.soundsoftware.ac.uk/attachments/download/1284/music-ro.db -wget_into ~/lib/mets https://code.soundsoftware.ac.uk/attachments/download/1283/DML_metadata_batch_01.tar.gz +cp_into ~/lib/beets https://code.soundsoftware.ac.uk/attachments/download/1284/music-ro.db +cp_into ~/lib/mets https://code.soundsoftware.ac.uk/attachments/download/1283/DML_metadata_batch_01.tar.gz - - +mkdir -p ~/var/dml/memo_db