summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-03-31 12:42:16 +0200
committerAndreas Maunz <andreas@maunz.de>2011-03-31 12:42:16 +0200
commit59f6d70df510eb5e009f71a15ccbf20053ec7975 (patch)
tree432593286a9307daf895973d0b06121b88712647
parent312d93bcc322fa5aca38f38cd266569aaf18b621 (diff)
all
-rwxr-xr-xbase-install.sh6
-rwxr-xr-xkernlab.sh5
-rwxr-xr-xnginx.sh5
-rwxr-xr-xopenbabel.sh9
-rwxr-xr-xopentox-ruby.sh5
-rwxr-xr-xopentox-webservices.sh5
-rwxr-xr-xredis.sh5
-rwxr-xr-xruby.sh49
-rw-r--r--utils.sh12
9 files changed, 44 insertions, 57 deletions
diff --git a/base-install.sh b/base-install.sh
index 27b895a..ea26dea 100755
--- a/base-install.sh
+++ b/base-install.sh
@@ -73,11 +73,7 @@ fi
pack_fail=""
for p in $pack_arr; do
echo -n "'$p': "
- if sudo $APTITUDE install "$p" -y >/dev/null 2>&1; then
- printf "%25s%15s\n" "'$p'" "DONE"
- else
- printf "%25s%15s\n" "'$p'" "FAIL"
- fi
+ cmd="sudo $APTITUDE install $p" && run_cmd "$cmd" "$p"
done
if [ -n "$pack_fail" ]; then
diff --git a/kernlab.sh b/kernlab.sh
index 5426744..20aea16 100755
--- a/kernlab.sh
+++ b/kernlab.sh
@@ -4,6 +4,9 @@
# Author: Christoph Helma, Andreas Maunz.
#
+source ./config.sh
+source ./utils.sh
+
if [ "$(id -u)" = "0" ]; then
echo "This script must be run as non-root." 1>&2
exit 1
@@ -23,8 +26,6 @@ if [ ! -e "$R" ]; then
fi
# Pkg
-source ./config.sh
-source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
echo "Kernlab ('$LOG')."
diff --git a/nginx.sh b/nginx.sh
index 6ccf914..27ddb05 100755
--- a/nginx.sh
+++ b/nginx.sh
@@ -4,6 +4,9 @@
# Author: Christoph Helma, Andreas Maunz.
#
+source ./config.sh
+source ./utils.sh
+
if [ "$(id -u)" = "0" ]; then
echo "This script must be run as non-root." 1>&2
exit 1
@@ -16,8 +19,6 @@ if [ ! -e "$PIN" ]; then
exit 1
fi
-source ./config.sh
-source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
echo "Nginx ('$LOG')."
diff --git a/openbabel.sh b/openbabel.sh
index b30d916..bd607c6 100755
--- a/openbabel.sh
+++ b/openbabel.sh
@@ -5,6 +5,9 @@
# Author: Christoph Helma, Andreas Maunz.
#
+source ./config.sh
+source ./utils.sh
+
if [ "$(id -u)" = "0" ]; then
echo "This script must be run as non-root." 1>&2
exit 1
@@ -18,12 +21,10 @@ if [ ! -e "$WGET" ]; then
fi
# Pkg
-source ./config.sh
-source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
-echo "Openbabel ('$OB_DEST', '$LOG')"
-
+echo
+echo "Openbabel ('$OB_DEST', '$LOG'):"
DIR="`pwd`"
diff --git a/opentox-ruby.sh b/opentox-ruby.sh
index 00bf8f1..0939635 100755
--- a/opentox-ruby.sh
+++ b/opentox-ruby.sh
@@ -4,6 +4,9 @@
# Author: Christoph Helma, Andreas Maunz.
#
+source ./config.sh
+source ./utils.sh
+
if [ "$(id -u)" = "0" ]; then
echo "This script must be run as non-root." 1>&2
exit 1
@@ -30,8 +33,6 @@ fi
# Pkg
-source ./config.sh
-source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
echo "Opentox-ruby ('$LOG'):"
diff --git a/opentox-webservices.sh b/opentox-webservices.sh
index ac0f95b..3dbcf4e 100755
--- a/opentox-webservices.sh
+++ b/opentox-webservices.sh
@@ -4,6 +4,9 @@
# Author: Christoph Helma, Andreas Maunz.
#
+source ./config.sh
+source ./utils.sh
+
if [ "$(id -u)" = "0" ]; then
echo "This script must be run as non-root." 1>&2
exit 1
@@ -16,8 +19,6 @@ if [ ! -e "$WGET" ]; then
exit 1
fi
-source ./config.sh
-source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
echo "Webservices ('$LOG'):"
diff --git a/redis.sh b/redis.sh
index 6f84316..b536f42 100755
--- a/redis.sh
+++ b/redis.sh
@@ -4,6 +4,9 @@
# Author: Christoph Helma, Andreas Maunz.
#
+source ./config.sh
+source ./utils.sh
+
if [ "$(id -u)" = "0" ]; then
echo "This script must be run as non-root." 1>&2
exit 1
@@ -16,8 +19,6 @@ if [ ! -e "$WGET" ]; then
exit 1
fi
-source ./config.sh
-source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
echo "This installs Redis."
diff --git a/ruby.sh b/ruby.sh
index c4377b7..9035d1c 100755
--- a/ruby.sh
+++ b/ruby.sh
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Installs Ruby enterprise edition and passenger gem.
+# A configuration file is created and included in your '~.bashrc'.
# Pass a ruby version string as first argument to install a specific version (blank for default).
# Author: Christoph Helma, Andreas Maunz.
#
@@ -22,11 +23,8 @@ source ./config.sh
source ./utils.sh
LOG="/tmp/`basename $0`-log.txt"
-
-echo "This installs Ruby Enterprise edition."
-echo "Your installation directory is '$RUBY_DEST'."
-echo "A configuration file is created and you are given the option to have it included in your '~.bashrc'."
-echo "Log file is '$LOG'."
+echo
+echo "Ruby Enterprise edition ('$RUBY_DEST', '$LOG')."
DIR="`pwd`"
@@ -42,26 +40,18 @@ else
fi
echo
-echo "Installing Ruby:"
+echo "Installing:"
if [ ! $RUBY_DONE ]; then
cd /tmp
URI="http://rubyenterpriseedition.googlecode.com/files/$RUBY_VER.tar.gz"
- if ! $WGET -O - "$URI" 2>>$LOG | tar zxv >>$LOG 2>&1 ; then
- printf "%25s%15s\n" "'Download'" "FAIL"
- exit 1
- fi
- printf "%25s%15s\n" "'Download'" "DONE"
- if ! sh "/tmp/$RUBY_VER/installer" --dont-install-useful-gems --no-dev-docs --auto="$RUBY_DEST" >>$LOG 2>&1 ; then
- printf "%25s%15s\n" "'Install'" "FAIL"
- exit 1
- fi
- printf "%25s%15s\n" "'Install'" "DONE"
+ cmd="$WGET -O - $URI" && run_cmd "$cmd" "Download"
+ cmd="sh /tmp/$RUBY_VER/installer --dont-install-useful-gems --no-dev-docs --auto=$RUBY_DEST" && run_cmd "$cmd" "Install"
fi
cd "$DIR"
echo
-echo "Preparing Ruby:"
+echo "Preparing:"
if ! [ -f "$RUBY_CONF" ]; then
@@ -79,7 +69,7 @@ source "$RUBY_CONF"
echo
-echo "Installing Passenger:"
+echo "Passenger:"
GEM="`which gem`"
if [ ! -e "$GEM" ]; then
echo "'gem' missing. Install 'gem' first. Aborting..."
@@ -88,30 +78,13 @@ fi
if [ "$PASSENGER_SKIP" != "s" ]; then
export PATH="$RUBY_DEST/bin:$PATH"
- if ! $GEM sources -a "http://gemcutter.org" >>$LOG 2>&1 ; then
- printf "%25s%15s\n" "'Add Gemcutter'" "FAIL"
- exit 1
- fi
- printf "%25s%15s\n" "'Add Gemcutter'" "DONE"
- if ! $GEM sources -r "http://rubygems.org" >>$LOG 2>&1 ; then
- printf "%25s%15s\n" "'Add Rubygems'" "FAIL"
- exit 1
- fi
- printf "%25s%15s\n" "'Add Rubygems'" "DONE"
+ cmd="$GEM sources -a http://gemcutter.org" && run_cmd "$cmd" "Add Gemcutter"
+ cmd="$GEM sources -a http://rubygems.org" && run_cmd "$cmd" "Add Rubygems"
GEMCONF="gem: --no-ri --no-rdoc"
if ! grep "$GEMCONF" $HOME/.gemrc >>$LOG 2>&1; then
echo "$GEMCONF" | tee -a $HOME/.gemrc >>$LOG 2>&1
fi
- if ! $GEM install passenger >>$LOG 2>&1 ; then
- printf "%25s%15s\n" "'Install Passenger'" "FAIL"
- exit 1
- fi
- printf "%25s%15s\n" "'Install Passenger'" "DONE"
-
+ cmd="$GEM install passenger" && run_cmd "$cmd" "Install Passenger"
fi
-echo
-echo "Ruby Installation finished."
-
-
diff --git a/utils.sh b/utils.sh
index cefd0fa..0cdbc69 100644
--- a/utils.sh
+++ b/utils.sh
@@ -9,5 +9,17 @@ function check_dest {
fi
}
+function run_cmd {
+ local cmd=$1
+ local title=$2
+
+ if ! eval $cmd >>$LOG 2>&1 ; then
+ printf "%25s%15s\n" "'$title'" "FAIL"
+ exit 1
+ fi
+ printf "%25s%15s\n" "'$title'" "DONE"
+
+}
+
check_dest
source ~/.bashrc