summaryrefslogtreecommitdiff
path: root/install
blob: 48b39fa932e172539258bee350c858412cb2b176 (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
#!/bin/sh

# Main Opentox-ruby install script
# Author: Christoph Helma, Andreas Maunz

[ "`id -u`" = "0" ] && echo "This script must not be run as root" 1>&2 && exit 1

echo
echo "OpenTox Ruby"
echo "Hit <Return> If all services are stoppped, else hit <Ctrl+C>."
read delete_me

echo "Note: CONFIG (~/.opentox) will be backupped."
mkdir -p $OT_PREFIX/tmp/ >/dev/null 2>&1
DATE=`date +_%Y%m%d_%H_%M`
echo "Backups (if any):"
backup_targets="$HOME/.opentox $HOME/opentox-ruby"
for bt in $backup_targets; do
  if [ -f $bt ]; then
    mv -v --backup=numbered $bt $bt$DATE
  elif [ -d $bt ]; then
    mv -v --backup=numbered -T $bt $bt$DATE
  fi
done
echo "Backup finished."

. ./utils.sh

check_log `basename $0`
echo
echo "Welcome to base installation for OpenTox compatible services on Ruby and Debian."
echo "IMPORTANT: Hit <Ctrl+C> to adjust config.sh first (<Return> to continue)."
read delete_me
echo 
echo -n "We need to do some privileged action. "
sudo echo -n ""
echo

[ -f $OT_PREFIX/install/utils.sh ] || (cmd="mkdir -p $OT_PREFIX/install && cp utils.sh $OT_PREFIX/install" && run_cmd "$cmd" "Install utils.sh to OT_PREFIX")
[ -f $HOME/.opentox/config/install/config.sh ] || (cmd="mkdir -p $HOME/.opentox/config/install && cp config.sh $HOME/.opentox/config/install" && run_cmd "$cmd" "Install config.sh to CONFIG (~/.opentox/config)")
[ -f $OT_DEFAULT_CONF ] || (cmd="echo '\$aa = { :uri => nil }' > $OT_DEFAULT_CONF" && run_cmd "$cmd" "Install default.rb to CONFIG (~/.opentox/config)")


#. ./base-install # Debian specific; disable this for others.
#./raptor2-install # Download, compile and build raptor2. Install to OT_PREFIX.
#./rasqal-install # Download, compile and build rasqal. Install to OT_PREFIX.
#./4store-install # Download, compile and build 4store. Install to OT_PREFIX.

check_utils "git"
if [ ! -d ~/.rbenv ]; then
  cmd="$GIT clone git://github.com/sstephenson/rbenv.git ~/.rbenv" && run_cmd "$cmd" "rbenv"
else
  echo "NOTE: 'rbenv' already installed. Leaving untouched."
fi

if ! grep "rbenv" $OT_UI_CONF >/dev/null 2>&1 ; then
  echo 'if ! echo "$PATH" | grep "$HOME/.rbenv/bin">/dev/null 2>&1; then export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; fi' >> $OT_UI_CONF
fi

[ -f $HOME/.opentox/config/ambit_descriptors.yaml ] || (cmd="cp ambit_descriptors.yaml $HOME/.opentox/config/" && run_cmd "$cmd" "Ambit keys file")
[ -f $HOME/.opentox/config/jl_keys.yaml ] || (cmd="cp jl_keys.yaml $HOME/.opentox/config/" && run_cmd "$cmd" "Joelib keys file")
[ -f $OT_TOOLS_CONF ] || (cmd="cp ot-tools-user.sh $OT_TOOLS_CONF" && run_cmd "$cmd" "Install ot-tools.sh to CONFIG (~/.opentox/config)")


# Install global ruby version
. "$OT_UI_CONF"
check_utils "rbenv"
[ "`$RBENV global 2>/dev/null`" = "$RUBY_NUM_VER" ] || (install_ruby global)

notify