summaryrefslogtreecommitdiff
path: root/opentox-webservices.sh
blob: f9a85e20e76038dfa34dfaf023c62115eb95ce80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
# Installs Opentox Webservices.
# Author: Christoph Helma, Andreas Maunz.
#

. "`pwd`/utils.sh"
DIR=`pwd`

if [ "$(id -u)" = "0" ]; then
  echo "This script must be run as non-root." 1>&2
  exit 1
fi

# Utils
WGET="`which wget`"
if [ ! -e "$WGET" ]; then
  echo "'wget' missing. Install 'wget' first. Aborting..."
  exit 1
fi

RAKE="`which rake`"
if [ ! -e "$RAKE" ]; then
  echo "'rake' missing. Install 'rake' first. Aborting..."
  exit 1
fi

GIT="`which git`"
if [ ! -e "$GIT" ]; then
  echo "'git' missing. Install 'git' first. Aborting..."
  exit 1
fi

RUBY="`which ruby`"
if [ ! -e "$RUBY" ]; then
  echo "'ruby' missing. Install 'ruby' first. Aborting..."
  exit 1
fi

LOG="$HOME/tmp/`basename $0`-log.txt"

echo
echo "Webservices ('$LOG'):"

mkdir -p "$WWW_DEST/opentox" >>$LOG 2>&1
cd "$WWW_DEST/opentox" >>$LOG 2>&1
for s in compound dataset algorithm model toxcreate task validation; do
    rm -rf "$s" >>$LOG 2>&1
    $GIT clone "git://github.com/opentox/$s.git" "$s" >>$LOG 2>&1
    cd "$s" >>$LOG 2>&1
    $GIT checkout -b $OT_BRANCH origin/$OT_BRANCH >>$LOG 2>&1
    #rm -rf public >>$LOG 2>&1
    #mkdir public >>$LOG 2>&1
    mypath_from="$WWW_DEST/opentox/$s/public"
    mypath_to="$WWW_DEST/$s"
    cmd="ln -sf \"$mypath_from\" \"$mypath_to\"" && run_cmd "$cmd" "Linking $s"
    cd - >>$LOG 2>&1
done

# fminer etc
cmd="test -f $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config present"
cd "$WWW_DEST/opentox/algorithm" >>$LOG 2>&1
cmd="$GIT submodule init" && run_cmd "$cmd" "Submodules init"
cmd="$GIT submodule update" && run_cmd "$cmd" "Submodules update"
cd "libfminer/libbbrc">>$LOG 2>&1
$GIT checkout $OT_BRANCH>>$LOG 2>&1
$GIT pull >>$LOG 2>&1
cd - >>$LOG 2>&1
cd "libfminer/liblast">>$LOG 2>&1
$GIT checkout $OT_BRANCH>>$LOG 2>&1
$GIT pull >>$LOG 2>&1
cd - >>$LOG 2>&1
for mylib in bbrc last; do
  cmd="sed -i 's,^INCLUDE_OB.*,INCLUDE_OB\ =\ -I$OB_DEST/include/openbabel-2.0,g' $WWW_DEST/opentox/algorithm/libfminer/lib$mylib/Makefile; sed -i 's,^LDFLAGS_OB.*,LDFLAGS_OB\ =\ -L$OB_DEST/lib,g' $WWW_DEST/opentox/algorithm/libfminer/lib$mylib/Makefile" && run_cmd "$cmd" "Makefile $mylib (OB)"
  cmd="sed -i 's,^INCLUDE_RB.*,INCLUDE_RB\ =\ -I$RUBY_DEST/lib/ruby/1.8/`uname -m`-linux,g' $WWW_DEST/opentox/algorithm/libfminer/lib$mylib/Makefile" && run_cmd "$cmd" "Makefile $mylib (RB)"
done
cd "libfminer/libbbrc">>$LOG 2>&1
cmd="make ruby" && run_cmd "$cmd" "Make BBRC"
cd - >>$LOG 2>&1
cd "libfminer/liblast">>$LOG 2>&1
cmd="make ruby" && run_cmd "$cmd" "Make LAST"
cd - >>$LOG 2>&1
cd "last-utils">>$LOG 2>&1
$GIT checkout $OT_BRANCH>>$LOG 2>&1
$GIT pull >>$LOG 2>&1
cd - >>$LOG 2>&1
cd "bbrc-sample">>$LOG 2>&1
$GIT checkout $OT_BRANCH>>$LOG 2>&1
$GIT pull >>$LOG 2>&1

cd "$DIR"