#! /bin/sh # $Id$ ######################################################################## # Aegir quick install script # # This script takes care of deploying all the required PHP scripts for # the frontend to run properly. It should be ran as the Aegir user. # # It should keep to strict POSIX shell syntax to ensure maximum # portability. The aim here is to ease the burden on porters but also # allow people using various platforms to zip through the install # quicker. # # This script also *DOES NOT CHECK* if the requirements 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. parse commandline # 2. prompt for confirmation # 3. creates a basic directory structure in $AEGIR_HOME # 4. downloads drush in $AEGIR_HOME # 5. downloads drush_make in $AEGIR_HOME/.drush # 6. downloads provision in $AEGIR_HOME/.drush # 7. deploys hostmaster in $AEGIR_HOME using drush # 8. creates an apache config file in $AEGIR_HOME/config/vhost.d # ######################################################################## # basic variables, change before release AEGIR_DOMAIN=aegir.example.com AEGIR_VERSION=HEAD AEGIR_HOME=$HOME WEB_GROUP=www-data # doesn't exist yet, but we need drush_prompt in HEAD DRUSH_VERSION=6.x-3.0-rc3 DRUSH_MAKE_VERSION=6.x-2.0-beta6 # when adding a variable here, add it to the display below ######################################################################## # functions # noticeable messages msg() { echo "==> $*" } # simple prompt prompt_yes_no() { while true ; do printf "$* [Y/n] " read answer if [ -z "$answer" ] ; then return 0 fi case $answer in [Yy]|[Yy][Ee][Ss]) return 0 ;; [Nn]|[Nn][Oo]) return 1 ;; *) echo "Please answer yes or no" ;; esac done } usage() { cat < /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 functionning properly" else msg "Drush is broken ($DRUSH help failed)" exit 1 fi if $DRUSH help | grep "^ make" > /dev/null ; then msg "Drush make already seems to be installed" else msg "Installing drush make in $AEGIR_HOME/.drush" mkdir -p $AEGIR_HOME/.drush $DRUSH dl drush_make-$DRUSH_MAKE_VERSION --destination=$AEGIR_HOME/.drush 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 git://git.aegirproject.org/provision $AEGIR_HOME/.drush/provision else cd $AEGIR_HOME/.drush wget http://files.aegirproject.org/provision-$AEGIR_VERSION.tgz gunzip -c provision-$AEGIR_VERSION.tgz | tar -xf - rm provision-$AEGIR_VERSION.tgz fi fi # this will prompt the user for the database password if not provided through stdin in JSON $DRUSH provision-verify --parent_path="$AEGIR_HOME" --web_group="$WEB_GROUP" --drush_path="$DRUSH" msg "Aegir provision backend installed successfully" if [ ! -z "$BACKEND_ONLY" ] ; then exit 0 fi if [ ! -d $HOSTMASTER_DIR ] ; then msg "Deploying hostmaster application" $DRUSH hostmaster-make $HOSTMASTER_DIR # this, and the remaining of this file, should be handled by # provision-install, see http://drupal.org/node/711740 cd $HOSTMASTER_DIR mkdir sites/$AEGIR_DOMAIN cp sites/default/default.settings.php sites/$AEGIR_DOMAIN/settings.php chmod g+w sites/$AEGIR_DOMAIN/settings.php mkdir sites/$AEGIR_DOMAIN/files chmod 2770 sites/$AEGIR_DOMAIN/files chgrp $WEB_GROUP sites/$AEGIR_DOMAIN/settings.php chgrp $WEB_GROUP sites/$AEGIR_DOMAIN/files fi if [ ! -f $AEGIR_HOME/config/vhost.d/$AEGIR_DOMAIN ]; then sed -e "s#DocumentRoot .*#DocumentRoot $HOSTMASTER_DIR#" -e "s#Directory .*#Directory $HOSTMASTER_DIR>#" -e "s/ServerName .*/ServerName $AEGIR_DOMAIN/" $HOSTMASTER_DIR/profiles/hostmaster/apache2.conf.txt > $AEGIR_HOME/config/vhost.d/$AEGIR_DOMAIN msg "Installed apache configuration file for $AEGIR_DOMAIN, you will need to restart apache" fi msg "Install process complete: follow the wizard" cat <