diff options
-rwxr-xr-x | base-install | 2 | ||||
-rwxr-xr-x | config.sh | 5 | ||||
-rwxr-xr-x | install | 8 | ||||
-rwxr-xr-x | utils.sh | 20 |
4 files changed, 26 insertions, 9 deletions
diff --git a/base-install b/base-install index 593bb0c..6e549d8 100755 --- a/base-install +++ b/base-install @@ -13,7 +13,7 @@ DIR=`pwd` # Not logged # Not logged [ "`id -u`" = "0" ] && echo "This script must not be run as root" 1>&2 && exit 1 -check_utils "aptitude apt-get apt-key git apt-cache dpkg tee wget" +check_utils "aptitude apt-get apt-key apt-cache dpkg tee wget" echo echo "Base Packages:" @@ -18,7 +18,7 @@ OT_JAVA_HOME="/usr/lib/jvm/java-6-openjdk" OB_NUM_VER="2.3.1" RAPTOR2_NUM_VER="2.0.8" RASQAL_NUM_VER="0.9.29" -RUBY_DWL="http://ftp.ruby-lang.org/pub/ruby/1.9" +RUBY_NUM_VER="1.9.3-p194" REDLAND_DWL="http://download.librdf.org" REDLAND_APT_KEY="http://purl.org/net/dajobe/gnupg.asc" @@ -40,7 +40,8 @@ RAPTOR2_VER="raptor2-$RAPTOR2_NUM_VER" RASQAL_VER="rasqal-$RASQAL_NUM_VER" OB_DEST="$OT_PREFIX/$OB_VER" OB_DEST_BINDINGS="$OT_PREFIX/openbabel-ruby-install" - +RUBY_DWL="http://ftp.ruby-lang.org/pub/ruby/1.9" +RUBY_DIR="$HOME/.rbenv/versions/$RUBY_NUM_VER" RAPTOR2_DWL="$REDLAND_DWL/source/$RAPTOR2_VER.tar.gz" RASQAL_DWL="$REDLAND_DWL/source/$RASQAL_VER.tar.gz" REDLAND_DEB="$REDLAND_DWL/binaries/$OT_DIST/unstable" @@ -26,7 +26,7 @@ echo "Backup finished." . ./utils.sh -LOG="$OT_PREFIX/tmp/`basename $0`.log" +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)." @@ -45,6 +45,7 @@ echo ./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 @@ -59,4 +60,9 @@ fi [ -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" "Created ot-tools (stored in ~/.opentox)") + +# Install global ruby version +. ./utils.sh +install_ruby global + notify @@ -61,7 +61,11 @@ run_cmd () # } check_utils() { for u in $1; do - eval `echo $u | tr "[:lower:]" "[:upper:]" | tr "-" "_"`=`which $u` || (echo "'$u' missing. Install '$u' first." 1>&2 && exit 1) + UPATH=`which $u` + if [ "$?" -eq 1 ]; then + echo "'$u' missing. Install '$u' first." 1>&2 && exit 1 + fi + eval `echo $u | tr "[:lower:]" "[:upper:]" | tr "-" "_"`=$UPATH done } @@ -69,7 +73,7 @@ check_utils() { # install ruby using rbenv # configure the version in config.sh install_ruby() { - printf "\n%50s\n" "RUBY" + printf "\n%50s\n" "RUBY (v. '$RUBY_NUM_VER')" local DIR=`pwd` check_utils "rbenv curl make tar" if ! $RBENV versions $RUBY_NUM_VER | grep $RUBY_NUM_VER>/dev/null 2>&1; then @@ -81,7 +85,13 @@ install_ruby() { fi cd $DIR cmd="$RBENV rehash" && run_cmd "$cmd" "Rbenv rehash" - cmd="$RBENV local $RUBY_NUM_VER" && run_cmd "$cmd" "Rbenv set ruby" + if [ "$1" = "global" ]; then + cmd="$RBENV global $RUBY_NUM_VER" && run_cmd "$cmd" "Rbenv set ruby global" + else + if ! $RBENV global | grep $RUBY_NUM_VER>/dev/null 2>&1; then + cmd="$RBENV local $RUBY_NUM_VER" && run_cmd "$cmd" "Rbenv set ruby local" + fi + fi } # install a ruby gem using bundler @@ -123,10 +133,10 @@ install_ot_service(){ # emit notification if caller was the shell (the user), see http://goo.gl/grCOk notify() { echo - echo "Installation succesful" + echo "Installation finished (check above for errors)" echo if ps -o stat= -p $PPID | grep "s" >/dev/null 2>&1; then - echo "IMPORTANT: How to configure your system:" + echo "IMPORTANT: How to configure your system if everything went fine:" echo "IMPORTANT: a) Include '$OT_TOOLS_CONF' in shell startup (e.g. ~/.bashrc)." echo "IMPORTANT: b) Manually source '$OT_TOOLS_CONF' every time." echo "IMPORTANT: The command in both cases: '. $OT_TOOLS_CONF'" |