summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2012-03-29 12:00:57 +0200
committerAndreas Maunz <andreas@maunz.de>2012-03-29 12:00:57 +0200
commite3d497014dbb24e0e2b4beee55c8221bc1fe3141 (patch)
tree127c5480d6b2e5ebd2e2f093b943be365e648f3d
parent3e2a76c4460ce16059430f6ede1feedecfea265a (diff)
Improved user experience
-rw-r--r--README31
-rwxr-xr-xbase-install.sh28
-rwxr-xr-xinstall31
-rwxr-xr-xutils.sh7
4 files changed, 52 insertions, 45 deletions
diff --git a/README b/README
index 2696fe0..2120c45 100644
--- a/README
+++ b/README
@@ -2,27 +2,22 @@ POSIX compatible Installer for OpenTox IST/ALU Services
=======================================================
Author: Andreas Maunz
-This is a POSIX-compliant (not limited to a particular shell) Opentox installer. Please report bugs via GitHub.
-
-Requirements:
-A) Debian or compatible (only 'base-install.sh')
-B) Your system is configured for 'sudo'.
+This is a POSIX-compliant (not limited to a particular shell) OpenTox required packages installer for Debian. It also prepares the base directory (referred to as OT_PREFIX) for OpenTox REST services and provides libraries for the installation and shell integration of those services.
+Please report bugs via GitHub at http://github.com/opentox/install.
Here are some of my goals when writing the installer:
-- Safe (existence of all the binaries will be checked before running, apart from GNU Core Utils)
-- Idempotent (multiple execution does not change anything)
-- Atomic (return value of each non-elemtary action is asserted to be TRUE)
-- Encapsulated (everything is installed in a sub-directory in $HOME)
-- Logged (all non-elemtary actions are logged)
-
-Usage:
-Configure your system in config.sh. Then run 'install'
+- Safe (existence of all binaries will be checked before running, apart from GNU Core Utils)
+- Idempotent (multiple execution incurs no changes to the system)
+- Atomic (return value of non-elementary actions asserted to be TRUE)
+- Encapsulated (everything installed in OT_PREFIX; applies to services)
+- Logged (all non-elementary actions are logged)
-Even if officially only *one* distro (currently Debian 6.0.1) is supported, I tested the installer successfully on various Ubuntus. Find the requirements at the top of this file. By default, everything is installed to $HOME/opentox-ruby (OT_PREFIX).
-
-After running the installer, configure the system by editing the startup file of your favorite shell (in my case, BASH with the file ~/.bashrc) to include ~/OT_PREFIX/.opentox-ui.sh (in my case with 'source ...'). OT_PREFIX is the only directory the installer creates. Thus, the system is fully configured: If you now open a new shell, all environment variables will be adjusted.
+Requirements:
+A) Debian or compatible (tested on Ubuntu 11.10).
+B) Users may gain root privileges using 'sudo'.
-To uninstall the system simply delete the link from the startup file: Done. To save disc space delete also directory OT_PREFIX.
+Usage:
+Configure the installer in config.sh, then run 'install'. Then configure your system by adding a line to the startup file of your favorite shell (e.g. BASH with the file '~/.bashrc') to read in '~/.opentox/.opentox-ui.sh' (e.g. with 'source ~/.opentox/.opentox-ui.sh'), so any newly started shell will be completely configured. To uninstall, simply remove the line from the startup file. To save disc space also remove directory OT_PREFIX. To remove also your configuration, remove $HOME/.opentox.
-You can run multiple Opentox versions on the same machine: Just install again, but to a different OT_PREFIX. The switch: Include the opentox-ui.sh files from the desired OT_PREFIX (only one installation may be activated at a time).
+You can run multiple Opentox versions on the same machine: Just install again as a different user.
diff --git a/base-install.sh b/base-install.sh
index f6d8b4d..1d7d2c5 100755
--- a/base-install.sh
+++ b/base-install.sh
@@ -1,10 +1,10 @@
#!/bin/sh
-#
-# Installs base packages for Ubuntu
+
+# Installs required packages on Debian and compatible systems.
# Author: Andreas Maunz
-#
-# Your installed packages are safe and will not be updated.
-# A Java configuration is created and included in your '$OT_UI_CONF'.
+
+# NOTE: Your installed packages are safe and will not be updated.
+# Java configuration is included in '$OT_UI_CONF'.
. ./utils.sh
DIR=`pwd`
@@ -15,16 +15,13 @@ if [ "$(id -u)" = "0" ]; then
fi
# Utils
-utils="aptitude git apt-cache dpkg"
-for u in $utils; do
- eval `echo $u | tr "[:lower:]" "[:upper:]" | tr "-" "_"`=`which $u` || (echo "'$u' missing. Install '$u' first." 1>&2 && exit 1)
-done
+check_utils "aptitude git apt-cache dpkg"
# Init main file
touch "$OT_UI_CONF"
# Pkgs
-packs="binutils build-essential cmake curl gnuplot hostname libcurl4-openssl-dev libgsl0-dev libopenbabel4 libopenbabel-dev libreadline6-dev libreadline-dev libsqlite3-dev libssl-dev libyaml-dev libxml2-dev libxslt1-dev lsb-release openjdk-6-jdk psmisc pwgen raptor-utils r-base r-base-core r-base-dev sqlite3 udev wget xsltproc zlib1g-dev"
+packs="binutils build-essential cmake curl gnuplot hostname libcurl4-openssl-dev libgsl0-dev libopenbabel4 libopenbabel-dev libraptor1-dev libreadline6-dev libreadline-dev libsqlite3-dev libssl-dev libyaml-dev libxml2-dev libxslt1-dev lsb-release openjdk-6-jdk psmisc pwgen raptor-utils r-base r-base-core r-base-dev sqlite3 udev wget xsltproc zlib1g-dev"
echo
echo "Base Packages:"
@@ -86,21 +83,10 @@ if [ ! -f $JAVA_CONF ]; then
echo 'if echo "$PATH" | grep -v '$OT_JAVA_HOME/bin'>/dev/null 2>&1; then export PATH='$OT_JAVA_HOME/bin':"$PATH"; fi' >> "$JAVA_CONF"
echo 'if ! [ -d "$JAVA_HOME" ]; then echo "$0: JAVA_HOME is not a directory!"; fi' >> "$JAVA_CONF"
- echo "Java configuration has been stored in '$JAVA_CONF'."
if ! grep "$JAVA_CONF" $OT_UI_CONF >/dev/null 2>&1; then
echo '. '$JAVA_CONF >> $OT_UI_CONF
fi
fi
-if [ ! -d ~/.rbenv ]; then
- cmd="$GIT clone git://github.com/sstephenson/rbenv.git ~/.rbenv" && run_cmd "$cmd" "rbenv"
-else
- echo "'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
-
cd "$DIR"
diff --git a/install b/install
index c9a9ddb..aaecd3e 100755
--- a/install
+++ b/install
@@ -1,7 +1,12 @@
#!/bin/sh
-# Main Opentox-ruby install script
+
+# Main OpenTox installer for user installation
# Author: Christoph Helma, Andreas Maunz
+# Creates OT_PREFIX and ~/.opentox (CONFIG). The latter contains OT_UI_CONF (see README).
+# Installs shell libraries and installer configuration to support installation of services.
+# Installs rbenv to support custom ruby versions for services.
+
if [ "$(id -u)" = "0" ]; then
echo "This script must not be run as root" 1>&2
exit 1
@@ -27,19 +32,33 @@ done
echo "Backup finished."
. ./utils.sh
+
LOG="$OT_PREFIX/tmp/`basename $0`.log"
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 install some packages. "
+echo -n "We need to do some privileged action. "
sudo echo -n ""
-rm -rf $OT_PREFIX/tmp/openbabel* $OT_PREFIX/tmp/ruby*
-cmd="mkdir -p $OT_PREFIX/install && cp utils.sh $OT_PREFIX/install" && run_cmd "$cmd" "Install utils.sh to OT_PREFIX"
-cmd="mkdir -p $HOME/.opentox/config/install && cp config.sh $HOME/.opentox/config/install" && run_cmd "$cmd" "Install config.sh to CONFIG (~/.opentox)"
-. ./base-install.sh
+[ -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)")
+
+. ./base-install.sh # Debian specific; disable for others.
+
+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")
echo
echo "Installation finished."
diff --git a/utils.sh b/utils.sh
index 8b5bbd0..8a41433 100755
--- a/utils.sh
+++ b/utils.sh
@@ -1,5 +1,11 @@
#!/bin/sh
+# Shell library for service installation and general tools
+# Author: Christoph Helma, Andreas Maunz
+
+# Functions to install ruby and install services with bundler.
+# Ensures presence of ~/.opentox (CONFIG) and OT_PREFIX.
+
check_dest()
{
[ -d "$OT_PREFIX/tmp" ] || mkdir -p "$OT_PREFIX/tmp"
@@ -69,3 +75,4 @@ fi
check_dest
touch "$OT_UI_CONF"
. "$OT_UI_CONF" 2>/dev/null
+