diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-09-30 16:49:41 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-09-30 16:49:41 -0300 |
commit | 08ba19a37f7cf11c84cc892f4a2d00dd2db4276b (patch) | |
tree | e18a9271739d72e83beafa7fd40d0984cd76cbc9 /templates/drupal.sh.erb | |
parent | 6ae847def402e94a406052f9b77fbc322f94ab5d (diff) | |
download | puppet-drupal-08ba19a37f7cf11c84cc892f4a2d00dd2db4276b.tar.gz puppet-drupal-08ba19a37f7cf11c84cc892f4a2d00dd2db4276b.tar.bz2 |
Reinstall support
Diffstat (limited to 'templates/drupal.sh.erb')
-rw-r--r-- | templates/drupal.sh.erb | 93 |
1 files changed, 49 insertions, 44 deletions
diff --git a/templates/drupal.sh.erb b/templates/drupal.sh.erb index 92dff75..45d15a0 100644 --- a/templates/drupal.sh.erb +++ b/templates/drupal.sh.erb @@ -232,9 +232,6 @@ function drupal_install { if [ -z "$2" ]; then echo "Usage: `basename $0` install <series> <name> [aliases]" exit 1 - elif [ -e "$BASE/drupal-$series/sites/$site" ]; then - echo "Drupal $site already installed at $BASE/drupal-$series" - exit 1 fi # Required arguments @@ -245,52 +242,59 @@ function drupal_install { # Site aliases aliases="$*" - # Check installation - if [ ! -e "$BASE/drupal-$series" ]; then - echo "Please deploy your drupal $series farm first" - exit 1 - fi - - echo "Creating $SITES/$site/drupal/ structure..." - mkdir -p $SITES/$site/drupal/files - - echo "Copying default configuration file..." - cp $BASE/drupal-$series/sites/default/default.settings.php $SITES/$site/drupal/settings.php - chmod 640 $SITES/$site/drupal/settings.php - - # Set files folder permission - if grep -qe "^$site:" /etc/passwd; then - chown root.$site $SITES/$site/drupal/settings.php - chown $site.$site $SITES/$site/drupal/files - else - chown root.www-data $SITES/$site/drupal/settings.php - chown www-data.www-data $SITES/$site/drupal/files - fi - - ( - echo "Creating symlinks..." - cd $BASE/drupal-$series/sites - ln -s $SITES/$site/drupal $site - ln -s $SITES/$site/drupal $site.`facter domain` - - for alias in $aliases; do - ln -s $SITES/$site/drupal $alias - done - ) - # Installation parameters drupal_user_input name "$site" "Site name" drupal_user_input profile "standard" "Installation profile" drupal_user_input locale "pt_BR" "Installation language" drupal_user_input admin "$site" "Admin user" drupal_user_input admin_email "$site@`facter domain`" "Admin email" - drupal_user_input dbname "$site" "Database name" - drupal_user_input dbuser "$site" "Database user" - drupal_user_input dbpasswd "$site" "Database passwd" - echo "Configuring settings.php" - if [ "$series" == "7" ]; then - cat >> $SITES/$site/drupal/settings.php <<-EOF + if [ -e "$BASE/drupal-$series/sites/$site" ]; then + echo "Drupal $site already installed at $BASE/drupal-$series" + echo "Installation will be overwritten" + else + # Check installation + if [ ! -e "$BASE/drupal-$series" ]; then + echo "Please deploy your drupal $series farm first" + exit 1 + fi + + echo "Creating $SITES/$site/drupal/ structure..." + mkdir -p $SITES/$site/drupal/files + + echo "Copying default configuration file..." + cp $BASE/drupal-$series/sites/default/default.settings.php $SITES/$site/drupal/settings.php + chmod 640 $SITES/$site/drupal/settings.php + + # Set files folder permission + if grep -qe "^$site:" /etc/passwd; then + chown root.$site $SITES/$site/drupal/settings.php + chown $site.$site $SITES/$site/drupal/files + else + chown root.www-data $SITES/$site/drupal/settings.php + chown www-data.www-data $SITES/$site/drupal/files + fi + + ( + echo "Creating symlinks..." + cd $BASE/drupal-$series/sites + ln -s $SITES/$site/drupal $site + ln -s $SITES/$site/drupal $site.`facter domain` + + for alias in $aliases; do + ln -s $SITES/$site/drupal $alias + done + ) + + # Aditional parameters + drupal_user_input dbname "$site" "Database name" + drupal_user_input dbuser "$site" "Database user" + drupal_user_input dbpasswd "$site" "Database passwd" + echo "" + + echo "Configuring settings.php" + if [ "$series" == "7" ]; then + cat >> $SITES/$site/drupal/settings.php <<-EOF \$databases['default']['default'] = array( 'driver' => 'mysql', 'database' => '$dbname', @@ -300,10 +304,11 @@ function drupal_install { 'prefix' => '', ); EOF - elif [ "$series" == "6" ]; then - cat >> $SITES/$site/drupal/settings.php <<-EOF + elif [ "$series" == "6" ]; then + cat >> $SITES/$site/drupal/settings.php <<-EOF \$db_url = 'mysql://$dbuser:$dbpasswd@localhost/$dbname'; EOF + fi fi ( |