Commit cb4bc5ed authored by gerd's avatar gerd

added


git-svn-id: https://gps.dynxs.de/private/svn/app-plasma/trunk@263 55289a75-7b90-4627-9e07-ffb4263930b2
parent 3c130f9a
#! /bin/sh
# This script builds and installs Plasma via GODI, i.e. the latest
# version that is available in GODI. A few important remarks:
#
# - The script creates a directory /opt/plasma and installs GODI
# there. It is not possible to use an existing GODI. It is also
# not possible to use another existing Ocaml installation (like
# the one coming with the OS distribution). There is no need
# to deinstall these - just put /opt/plasma/bin before them in
# PATH.
# - The script installs missing system packages. So far this works
# only for a few Linux distributions. Users of other OS are on
# their own here.
# - The script needs to run a few commands as root. It knows several
# methods of becoming root (su, sudo, ssh root@localhost). You can
# select the right one on the command line.
# - The script builds Plasma. This is only required on one machine,
# the buildhost. Once this is done you can deploy from there (see
# manual). On the namenodes and datanodes it may be nevertheless
# required to install OS packages. For this reason, there is a
# -namenode and -datanode mode.
#
# DO NOT RUN THIS SCRIPT AS ROOT!
set -e
usage() {
cat <<EOF
usage: $0 [options]...
List of options:
-root <path> Install into this path (default: /opt/plasma)
-os (debian|redhat|suse) Assume this OS (default: auto-detected)
-su Use "su" to become root
-sudo Use "sudo" to become root
-ssh Use "ssh root@localhost" to become root
-noroot Skip root stuff
-namenode Only install packages for namenode
-datanode Only install packages for datanode
EOF
}
root=/opt/plasma
os=""
rootmeth=""
mode=build
while [ $# -gt 0 ]; do
case "$1" in
-root)
root="$2"; shift 2;;
-os)
os="$2"; shift 2;;
-su)
rootmeth="su"; shift ;;
-sudo)
rootmeth="sudo"; shift ;;
-ssh)
rootmeth="ssh"; shift ;;
-noroot)
rootmeth="none"; shift ;;
-namenode)
mode="namenode"; shift ;;
-datanode)
mode="datanode"; shift ;;
*)
usage >&2; exit 2 ;;
esac
done
######################################################################
# Auto-detect OS
######################################################################
if [ -f /etc/debian_version ]; then
os="debian"
fi
######################################################################
# Packages to install
######################################################################
debian_build_pkgs="build-essential wget gzip bzip2 patch m4 libpq-dev \
libpcre3-dev postgresql"
debian_namenode_pkgs="libpq5 libpcre3 postgresql"
debian_datanode_pkgs="libpq5 libpcre3"
pkgs=""
case "$os,$mode" in
debian,build)
pkgs="$debian_build_pkgs" ;;
debian,namenode)
pkgs="$debian_namenode_pkgs" ;;
debian,datanode)
pkgs="$debian_datanode_pkgs" ;;
esac
pscript=""
pmsg=""
case "$os" in
debian)
pscript="apt-get install $pkgs"
pmsg="installing packages" ;;
esac
######################################################################
# Prepare root dir
######################################################################
thisuser=`id -u`
thisgroup=`id -g`
rscript=""
rmsg=""
if [ mode = "build" ]; then
rscript="mkdir -p '$root'; chown $thisuser:$thisgroup '$root'"
rmsg="preparing $root"
fi
######################################################################
# Do stuff as root
######################################################################
if [ -n "$pscript" -o -n "$rscript" ]; then
script="${pscript:-true}; ${rscript:-true}"
if [ -n "$pmsg" -a -n "$rmsg" ]; then
msg="$pmsg, $rmsg"
else
msg="$pmsg$rmsg"
fi
if [ "$rootmeth" != none ]; then
echo "*******************************************************************"
echo "* Doing as root: $msg"
echo "*******************************************************************"
fi
case "$rootmeth" in
su)
su -c "$script" ;;
sudo)
sudo "$script" ;;
ssh)
ssh root@localhost "$script" ;;
none)
true ;;
esac
fi
if [ "$mode" != "build" ]; then
echo "*******************************************************************"
echo "* Done with system preparation."
echo "*******************************************************************"
exit 0
fi
######################################################################
# Install GODI
######################################################################
tmpdir="/tmp/plasmainstall.$$"
echo "*******************************************************************"
echo "* Using $tmpdir for bootstrapping GODI"
echo "*******************************************************************"
mkdir $tmpdir
cd $tmpdir
wget http://download.camlcity.org/download/godi-rocketboost-20091222.tar.gz
tar xzf godi-rocketboost-20091222.tar.gz
cd godi-rocketboost-20091222
echo | ./bootstrap --prefix "$root/." --section 3.11
PATH="/opt/$root/bin:/opt/$root/sbin:$PATH"
export PATH
./bootstrap_stage2
cd $HOME
rm -rf "$tmpdir"
######################################################################
# Install Plasma
######################################################################
echo "*******************************************************************"
echo "* Installing Plasma"
echo "*******************************************************************"
echo "GODI_BUILD_SITES+=http://www.ocaml-programming.de/godi-build/ocamlnet3/" >>"$root/etc/godi.conf"
echo "GODI_OCAMLGRAPH_VIEWER=no" >>"$root/etc/godi.conf"
godi_console update
godi_console perform -build godi-plasma
echo "*******************************************************************"
echo "* Done with Plasma build"
echo "* Plasma root: $root"
echo "*******************************************************************"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment