changeset 9:21dbe74c63bb

Working on setup script.
author samer
date Sun, 18 Jan 2015 21:55:24 +0000
parents d364e8ee791c
children 0eba4de3988f
files .hgignore etc/setup_as_dml.sh
diffstat 2 files changed, 53 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Jan 18 21:25:23 2015 +0000
+++ b/.hgignore	Sun Jan 18 21:55:24 2015 +0000
@@ -15,8 +15,8 @@
 ^.config
 .gitconfig
 .gitignore
+/.git$
 ^.swipl-dir-history
-^lib/charm
 ^var/dml/.swipl_history
 ^var/dml/cache
 ^var/dml/storage
@@ -24,5 +24,7 @@
 ^var/dml/memo_db
 ^var/dml/users.db
 ^var/log
-/.git$
+^lib/charm
 ^lib/swipl
+^lib/beets
+^lib/mets
--- a/etc/setup_as_dml.sh	Sun Jan 18 21:25:23 2015 +0000
+++ b/etc/setup_as_dml.sh	Sun Jan 18 21:55:24 2015 +0000
@@ -1,32 +1,65 @@
 #!/bin/sh
+# ------------------ CONFIG ----------------
 
-echo 'THIS IS NOT READY YET!'
-exit 1
+CLEANUP=no
+INSTALL_SWI=no
 
 function install_swi {
-	cd ~/src
-	wget http://www.swi-prolog.org/download/devel/src/pl-7.1.28.tar.gz
-	tar xzf pl-7.1.28.tar.gz
-	cd pl-7.1.28
+	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
 	patch build ~/etc/swipl-build.patch
 	./build
 }
 
+function unpack_into {
+	wget_into ~/downloads "$2"
+	arname=$(basename "$2")
+	cd "$1"
+	tar xzf "~/downloads/$arname"
+	if [ $CLEANUP == yes ]; then
+		rm "~/downloads/$arname"
+	fi
+}
 
-#build SWI Prolog
-install_swi
+function wget_into {
+	mkdir -p "$1"
+	cd "$1"
+	wget "$2"
+}
+
+function get_repo_into {
+	dest="$1"
+	repo="$3"
+	cmd=$2
+	shift 3
+
+	name=$(basename "$repo")
+	cd "$dest"
+	if [ -d $name ]; then
+		echo "$name repository alread present in $dest"
+	else
+		$cmd clone "$repo" $* 
+	fi
+}
+
+if [ $INSTALL_SWI == yes ]; then
+	install_swi
+fi
 
 # DOWNLOADS FROM REPOs
-cd ~/src/github
-git clone https://samer--/ClioPatria
-git clone --recursive https://github.com/humdrum-tools/humdrum-tools
-
-cd ~/src/hg
-hg clone https://code.soundsoftware.ac.uk/hg/dml-cliopatria
-hg clone https://code.soundsoftware.ac.uk/hg/ishara
-hg clone https://code.soundsoftware.ac.uk/hg/kernscores-utf8
+get_repo_into ~/src/github git https://samer--/ClioPatria
+get_repo_into ~/src/github git https://github.com/humdrum-tools/humdrum-tools --recursive
+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
 
+
+