#!/bin/bash -x #--------- # add a platform to BOA # nick@internetmachines.co.uk march 2013 #--------- # use the root account if ! [ $(id -u) = 0 ]; then echo "Run this script using the root account." exit 1 fi # #--------- # which customer and platform? # if you want the heredoc below to see these vars, export them. client=o1 boadistro=002 globalplatforms=/data/all/$boadistro clientplatforms=/data/disk/$client/distro/$boadistro clientlinks=/home/$client.ftp/platforms/$boadistro project=drupal-7.21 newplatform=drupal-7.21-prod # #--------- # create the global platform. cd $globalplatforms drush dl $project mv $project $newplatform # this kicks off commands like # wget -P . http://ftp.drupal.org/files/projects/drupal-7.21.tar.gz # # make cache folders (why? what are these?) mkdir $newplatform/cache mkdir $newplatform/cache/normal mkdir $newplatform/cache/perm # # ownership and permissions for the global platform chmod -R 777 $newplatform/cache chown -R $client.users $newplatform # # add in BOA's contrib module selection cd $newplatform/modules ln -s $globalplatforms/o_contrib_seven # #--------- # create the client platform cd $clientplatforms mkdir $newplatform cd $newplatform # # add links for i in `ls $globalplatforms/$newplatform` do ln -s $globalplatforms/$newplatform/$i done # this makes a few too many links. # replace some symlinks with dirs and files rm cache sites # # add other stuff cp -rp \ $globalplatforms/$newplatform/cache \ $globalplatforms/$newplatform/sites \ . cd .. # ownership and permissions for the client platform chown -R $client.users $newplatform # create the client’s link to the platform cd $clientlinks ln -s $clientplatforms/$newplatform/sites # # use the client account su --shell /bin/bash $client <