Skip to content

Instantly share code, notes, and snippets.

@turtlebender
Created December 25, 2011 00:45
Show Gist options
  • Select an option

  • Save turtlebender/1518572 to your computer and use it in GitHub Desktop.

Select an option

Save turtlebender/1518572 to your computer and use it in GitHub Desktop.
Install globusonline wordpress on os x
#!/bin/bash
echo "Check if RVM is installed"
which rvm > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "RVM is already installed, skipping"
else
echo "Installing RVM"
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo "Updating .bash_profile to load rvm"
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile
echo "Configuring RVM to use 1.9.2. This may take a few minutes"
rvm install 1.9.2
rvm default 1.9.2
rvm use 1.9.2
fi
echo "Check if Homebrew is installed"
which brew > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Homebrew is already installed, skipping"
else
echo "Installing Homebrew."
mkdir -p /usr/local/Cellar
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
fi
brew info php > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Downloading php homebrew formula"
wget https://raw.github.com/adamv/homebrew-alt/master/duplicates/php.rb
mv php.rb `brew --prefix`/Library/Formula
fi
which php > /dev/null 2<&1
if [ $? -ne 0 ]
then
echo "Installing php5"
brew install php --with-mysql --with-apache
chmod -R ug+w /usr/local/Cellar/php/5.3.8/lib/php
pear config-set php_ini /usr/local/etc/php.ini
else
echo "php5 is already installed. Skipping"
fi
if grep -q '#LoadModule php5_module' /etc/apache2/httpd.conf
then
echo "Updating apache configuration to support PHP5"
sudo perl -p -i.bak -e 's/#LoadModule php5_module libexec\/apache2\/libphp5.so/LoadModule php5_module \/usr\/local\/Cellar\/php\/5.3.8\/libexec\/apache2\/libphp5.so/' /etc/apache2/httpd.conf
sudo /usr/sbin/apachectl restart
fi
grep -q 'wordpress-local' /etc/apache2/extra/httpd-vhosts.conf
if [ $? -ne 0 ]
then
echo "Adding go.wordpress VirtualHost"
cat << 'EOF' > /tmp/vhosts
<VirtualHost go.wordpress-local.globusonline.org:80>
ServerName wordpress-local.globusonline.org
ServerAlias go.wordpress-local.globusonline.org
DocumentRoot "/var/www/go-wordpress"
<Directory /var/www/go-wordpress>
Options FollowSymLinks
AllowOverride ALL
Order allow,deny
Allow from all
</Directory>
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
</VirtualHost>
EOF
sudo sh -c 'cat /tmp/vhosts >> /etc/apache2/extra/httpd-vhosts.conf'
rm /tmp/vhosts
fi
function link_wordpress_dir {
if [ -d /var/www/go-wordpress ]
then
read -p "/var/www/go-wordpress already exists. Should we remove it in order to link your repository? " REMOVE_THEN_LINK
case $REMOVE_THEN_LINK in
[Nn]* ) exit;;
[Yy]* ) sudo rm /var/www/go-wordpress;;
esac
fi
sudo ln -s $1 /var/www/go-wordpress
}
function has_existing_checkout {
read -e -p "Where is your checkout currently located? " WORD_LOC
}
needs_checkout () {
read -p "To where should we checkout the repo? " WORD_LOC
if [ -d $WORD_LOC ]
then
echo "\n$WORD_LOC already exists, either choose another location or move the existing directory out of the way"
exit 1;
fi
git clone git@github.com:/globusonline/wordpress $WORD_LOC
}
read -p "Do you already have the globusonline wordpress repository checked out? " CHECKED_OUT
case $CHECKED_OUT in
[Yy]* ) has_existing_checkout;;
[Nn]* ) needs_checkout;;
esac
link_wordpress_dir $WORD_LOC
grep -q 'wordpress-local' /etc/hosts
if [ $? -ne 0 ]
then
echo "Updating /etc/hosts file to include wordpress-local"
sudo sh -c "echo '127.0.0.1 wordpress-local.globuscs.info' >> /etc/hosts"
sudo sh -c "echo '127.0.0.1 go.wordpress-local.globuscs.info' >> /etc/hosts"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment