Friday 26 February 2010

Drupal installer script - version 2

Hi Readers,

Last night I felt the need of a new Drupal installer script. My old one (http://itarato.blogspot.com/2009/06/drupal-sandbox-creator-shell-script.html) had some flaws: it used a static preinstalled tarball with a static database dump. My new one use a fresh Drupal 6.15 package and just help to get to the install screen:
echo "> Install Drupal Site - v 0.1"
# Enter the webroot
cd YOURWEBROOT
# Uncompress the latest Drupal tarball
tar -xzf PATHTOTARBALL/drupal-6.15.tar.gz
# Asks for a site name (folder - database in one step)
read -p "> Site name: " site_name
# Rename the web folder
mv drupal-6.15 $site_name
echo "> Site folder is ready"
# Create config files
cd $site_name/sites/default
mkdir files
cp default.settings.php settings.php
# Setting file ownerships
sudo chown WEBSERVERUSER files
sudo chown WEBSERVERUSER settings.php
echo "> Config is ready"
# Creating database
mysql -u root --password=YOURPASSWORD -e "create database $site_name"
# Under OS-X opens a browser with the site's install screen
open http://localhost/$site_name
echo "> Arigato gozai mashi ta!"


Basically you need a Drupal package under: PATHTOTARBALL/drupal-6.15.tar.gz and that's it. Dont't forget to change all the capital letter words to your environment.

Regards,
Peter

1 comment:

  1. Cool script, thanks!

    Some ideas for version 3:
    - instead of hardcoding a drupal version, you could use
    drush dl drupal
    which will always get the current stable release.
    - consider extending your script using twill (http://twill.idyll.org/)
    With twill you will be able to automate the whole installation process (that usually a monkey could do for some bananas).

    Thanks again,
    Erno

    ReplyDelete

Note: only a member of this blog may post a comment.