Skip to content
install.sh.txt 3.01 KiB
Newer Older
#! /bin/sh

# $Id$

########################################################################
# Aegir quick install script
#
# This script is just a wrapper to the hostmaster-install command, which
# is part of the provision module. It is designed to be quickly
# downloaded and ran as the Aegir user (created as per the INSTALL.txt)
# and bootstrap aegir by downloading drush and provision.
#
# The real work happens in PHP, within the hostmaster-install command.
#
# It should keep to strict POSIX shell syntax to ensure maximum
# portability. The aim here is to ease the burden allow people using
# various platforms to zip through the install quicker.
# This script also *DOES NOT CHECK* if the requirements specified in
# INSTALL.txt have been met.  It's up to the admin to follow the proper
# install instructions or use the packages provided by their platform.
########################################################################
# This script takes the following steps:
#
# 1. downloads drush in $AEGIR_HOME
# 2. downloads provision in $AEGIR_HOME/.drush
# 3. delegate the rest of the install to hostmaster-install
########################################################################

# guess the aegir version based on the info file
AEGIR_VERSION="6.x-1.0-rc2"

########################################################################
# functions

# noticeable messages
msg() {
  echo "==> $*"
}

########################################################################
# Main script

DRUSH="$AEGIR_HOME/drush/drush.php"

if [ `whoami` = "root" ] ; then
  msg "This script should be ran as a non-root user"
  exit 1
fi

# we need to check both because some platforms (like SunOS) return 0 even if the binary is not found
if which drush 2> /dev/null && which drush | grep -v 'no drush in' > /dev/null; then
  msg "Drush is in the path, good"
  DRUSH=drush
elif [ -x $DRUSH ] ; then
  msg "Drush found in $DRUSH, good"
  DRUSH="php $AEGIR_HOME/drush/drush.php"
else
  msg "Installing drush in $AEGIR_HOME"
  cd $AEGIR_HOME
  wget http://ftp.drupal.org/files/projects/drush-$DRUSH_VERSION.tar.gz
  gunzip -c drush-$DRUSH_VERSION.tar.gz | tar -xf -
  rm drush-$DRUSH_VERSION.tar.gz
  DRUSH="php $AEGIR_HOME/drush/drush.php"
fi

if $DRUSH help > /dev/null ; then
  msg "Drush seems to be functioning properly"
else
  msg "Drush is broken ($DRUSH help failed)"
  exit 1
fi

if $DRUSH help | grep "^ provision-install" > /dev/null ; then
  msg "Provision already seems to be installed"
else
  msg "Installing provision backend in $AEGIR_HOME/.drush"
  mkdir -p $AEGIR_HOME/.drush
  if [ "$AEGIR_VERSION" = "HEAD" ]; then
    git clone http://git.drupal.org/project/provision.git $AEGIR_HOME/.drush/provision
  else
    cd $AEGIR_HOME/.drush
    wget http://ftp.drupal.org/files/projects/provision-$AEGIR_VERSION.tar.gz
    gunzip -c provision-$AEGIR_VERSION.tar.gz | tar -xf -
    rm provision-$AEGIR_VERSION.tar.gz
$DRUSH hostmaster-install --version=$AEGIR_VERSION $@