summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2015-06-03 13:26:56 +0200
committerrautenberg <rautenberg@in-silico.ch>2015-06-03 13:26:56 +0200
commitf2cf91fb6ec051535bbd1172eb52a10f60f0be0a (patch)
treeecd485b388fad19aa584b64bea1356f3e469bb72
parent81a048cb8a0353bf9306c7ce3ea24f9ee54ba9d3 (diff)
initiel installer
-rw-r--r--bin/miniaa-install72
1 files changed, 72 insertions, 0 deletions
diff --git a/bin/miniaa-install b/bin/miniaa-install
new file mode 100644
index 0000000..a314b8b
--- /dev/null
+++ b/bin/miniaa-install
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# Installs Opentox Webservice.
+# Author: Christoph Helma, Andreas Maunz.
+
+SELF=$(basename $0 -install)
+[ "`id -u`" = "0" ] && echo "This script must be run as non-root." 1>&2 && exit 1
+
+SILENT=false
+if [ -n "$1" ]
+then
+ if [ "$1" = "silent" ]
+ then
+ SILENT=true
+ fi
+fi
+
+if [ $SILENT = false ]; then
+ echo
+ echo "Welcome to service installation (<Return> to continue)."
+ read delete_me
+fi
+
+# check wd is root of service
+DIR=`pwd`
+if echo $DIR | grep "$SELF/bin" >/dev/null 2>&1 ; then cd ..; fi
+
+# # # Boot the script
+
+# load base config, helper funs, environment
+OT_CONFIG_DIR="$HOME/.opentox"
+! [ -f "$OT_CONFIG_DIR/config/install/config.sh" ] && echo "config.sh not found." 1>&2 && exit 1 || . $OT_CONFIG_DIR/config/install/config.sh
+! [ -f "$OT_PREFIX/install/utils.sh" ] && echo "utils.sh not found." 1>&2 && exit 1 || . $OT_PREFIX/install/utils.sh
+[ -f $OT_CONFIG_DIR/opentox-ui.sh ] && . $OT_CONFIG_DIR/opentox-ui.sh # should have been done by user already
+RUBY_DIR="$HOME/.rbenv/versions/$RUBY_NUM_VER"
+
+
+# # # Install
+
+check_utils "rbenv find"
+check_log $SELF
+
+if [ "$OT_BRANCH" = "development" ]; then
+ cmd="test -d $OT_PREFIX/opentox-server" && run_cmd "$cmd" "Opentox-server"
+ cmd="test -d $OT_PREFIX/opentox-client" && run_cmd "$cmd" "Opentox-client"
+fi
+
+
+# log directory for this service
+[ -d $OT_CONFIG_DIR/config/$SELF ] || cmd="mkdir -p $OT_CONFIG_DIR/config/$SELF" && run_cmd "$cmd" "Config directory"
+
+# Adjust ruby version here!
+RUBY_NUM_VER="2.0.0-p481"
+
+# ruby
+install_ruby
+
+# self
+echo
+install_with_bundler
+
+# config
+[ -f $OT_CONFIG_DIR/config/$SELF.rb ] || touch $OT_CONFIG_DIR/config/$SELF.rb
+if ! cat "$OT_CONFIG_DIR/config/$SELF.rb" | grep "aa">/dev/null 2>&1; then echo '$aa = { :uri => nil }' >> $OT_CONFIG_DIR/config/$SELF.rb; fi
+if ! cat "$OT_DEFAULT_CONF" | grep "$SELF">/dev/null 2>&1; then echo '$miniaa = { :uri => "http://localhost:8099/miniaa" }' >> $OT_DEFAULT_CONF; fi
+
+if [ $SILENT = false ]; then
+ notify
+fi
+
+# return to wd
+cd "$DIR"