#!/bin/bash # Copyright (c) 2012 VMware, Inc. # Install vcap components on Ubuntu systems. set -o errexit usage() { cat < /dev/null; then echo "Giving up. Cannot connect to the web. Check your proxy settings if you are behind a proxy." exit 1 fi # Install chef readonly PREREQUISITES=(ruby ruby-dev libopenssl-ruby rdoc ri irb build-essential ssl-cert) echo "Installing prerequisites..." run_cmd apt-get $APT_CONFIG install -qym "${PREREQUISITES[@]}" if [ ! -f ${GEM} ] || [ `${GEM} -v` \< "1.3.6" ]; then # Blobstore_client requires gem >= 1.3.6 echo "Installing rubygems..." CWD=`pwd` cd /tmp wget -q http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz tar zxf rubygems-1.3.6.tgz cd rubygems-1.3.6 sudo ${RUBY} setup.rb --no-format-executable > /dev/null cd ${CWD} fi # we need to install net-ssh ans net-ssh-gatewayto avoid dependency problems on chef. echo "Installing net-ssh..." NET_SSH_VERSION="2.2.2" ${GEM} list -i net-ssh -v ${NET_SSH_VERSION} || sudo ${GEM} install net-ssh --version ${NET_SSH_VERSION} -q --no-ri --no-rdoc > /dev/null echo "Installing net-ssh-gateway..." NET_SSH_GATEWAY_VERSION=" 1.0.0" ${GEM} list -i net-ssh-gateway -v ${NET_SSH_GATEWAY_VERSION} || sudo ${GEM} install net-ssh-gateway --version ${NET_SSH_GATEWAY_VERSION} -q --no-ri --no-rdoc > /dev/null echo "Installing chef..." CHEF_VERSION="10.16.4" ${GEM} list -i chef -v ${CHEF_VERSION} || sudo ${GEM} install chef --version ${CHEF_VERSION} -q --no-ri --no-rdoc > /dev/null # Install blobstore_client echo "Installing blobstore_client..." BLOB_VERSION="0.4.0" ${GEM} list -i blobstore_client -v ${BLOB_VERSION} || sudo ${GEM} install blobstore_client --version ${BLOB_VERSION} -q --no-ri --no-rdoc > /dev/null # Install rake echo "Installing rake..." ${GEM} list -i rake -i || sudo ${GEM} install rake -q --no-ri --no-rdoc > /dev/null # Clone cloudfoundry repo echo "Installing git..." run_cmd apt-get $APT_CONFIG install -qym git-core [ -d $CLOUDFOUNDRY_HOME ] || mkdir $CLOUDFOUNDRY_HOME REPO=vcap if [ ! -d $CLOUDFOUNDRY_HOME/${REPO} ]; then if ! (cd $CLOUDFOUNDRY_HOME git clone --no-checkout $VCAP_REPO_BASE/$REPO cd $REPO git checkout $VCAP_REPO_BRANCH git submodule update --recursive --init ); then echo "Unable to clone cloudfoundry $REPO repo." exit 1 fi else clear_bundler_settings $CLOUDFOUNDRY_HOME/$REPO fi # Launch chef ARGS="" if [ -n "$CLOUDFOUNDRY_HOME" ]; then ARGS="-d $CLOUDFOUNDRY_HOME" fi if [ -n "$CLOUDFOUNDRY_DOMAIN" ]; then ARGS="$ARGS -D $CLOUDFOUNDRY_DOMAIN" fi if [ -n "$CONFIG_FILE" ]; then ARGS="$ARGS -c $CONFIG_FILE" fi echo "" echo "Launching chef..." sleep 3 $CLOUDFOUNDRY_HOME/vcap/dev_setup/lib/chefsolo_launch.rb $ARGS