Skip to content

Instantly share code, notes, and snippets.

@doostinharrell
Forked from trevor-atlas/drupal-install.sh
Last active August 29, 2015 14:06
Show Gist options
  • Save doostinharrell/b58fb9aa7fd7a178ae13 to your computer and use it in GitHub Desktop.
Save doostinharrell/b58fb9aa7fd7a178ae13 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This is usually run by the d_install script (https://gist.github.com/treall/240b8408cd944c17551a)
# This script will:
# make sure you're in the correct directory,
# download the latest drupal 7 release,
# install our frequently used modules,
# setup the admin account,
# create an Aurora subtheme,
# update the .htaccess file for use on our outdated dev server,
# run cron.
# Make sure we're in the right place.
read -p "You MUST be in the sites root directory for this to work.(EG: /home/sitename) Are you in the right place?" -n 1 -r
echo "\n"
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "\e[32m---Starting up---\e[0m"
# Check arguments and requirements.(make sure we got a site name from the d_install script)
if [ -e $1 ];
then
echo -e "\e[31mERROR: please supply site name ie: thewiredmouse\e[0m"
exit 1
fi
sitename=${1}
if [ -e $2 ];
then
echo -e "\e[31mERROR: please supply site password\e[0m"
exit 1
fi
password=${2}
# Download the latest Drupal 7 version.
echo -e "\e[32mDownloading the latest release of Drupal 7. Please wait...\e[0m"
drush -q dl -y drupal-7 --drupal-project-rename=public_html
echo -e "\e[32mCreate settings.php...\e[0m"
# Create a settings.php
cp public_html/sites/default/default.settings.php public_html/sites/default/settings.php
# Change ownership
chown -R $sitename:$sitename public_html/sites
# chmod -R 2775 public_html/sites/*
# Give the web server write privileges (666 or u=rw,g=rw,o=rw) to the configuration file.
chmod a+w public_html/sites/default/settings.php
# Give the web server write privileges to the sites/default directory.
chmod a+w public_html/sites/default
cd public_html/
# Install Drupal and setup admin user account.
echo -e "\e[32mInstalling Drupal, please wait...\e[0m"
drush site-install standard --db-url=mysql://root:zxsw21@localhost/$sitename --site-name=www.$sitename.com --account-name=twmadmin --account-pass="$password" [email protected] -y
# Prepare Drupal for work.
echo -e "\e[32mInstalling and configuring modules...(Be patient)\e[0m"
drush -q dis -y update seven overlay color comment help search bartik admin_menu_toolbar -y
drush -q dl -y omega aurora libraries extlink panels fences borealis blockify modernizr html5_tools magic weight field_group responsive_menus responsive_dropdown_menus block_class location linkchecker mollom jquery_update honeypot google_analytics media select_or_other date features admin_menu adminimal_theme adminimal_admin_menu devel module_filter webform imce pathauto site_map link ckeditor xmlsitemap metatag globalredirect redirect module_filter link_css admin_views
drush -q en -y omega aurora libraries extlink panels fences borealis blockify modernizr html5_tools magic weight field_group responsive_menus responsive_dropdown_menus block_class location linkchecker mollom jquery_update honeypot googleanalytics media select_or_other date features contextual field_ui adminimal_admin_menu admin_devel devel module_filter webform imce ckeditor pathauto site_map link xmlsitemap metatag globalredirect redirect module_filter link_css admin_views
drush -q vset cron_safe_threshold 0
drush -q vset devel_raw_names 1
# Create subtheme
drush -q omega-subtheme $sitename_omega_theme
# Omega and Zen are deprecated in favor of yeoman aurora (https://www.drupal.org/project/aurora)(https://github.com/Snugug/generator-aurora)
#enable admin theme
drush -q en adminimal -y
#drush -q en aurora -y
drush -q vset admin_theme adminimal
drush vset theme_default $sitename_omega_theme -y
cd ..
echo -e "\e[32mUpdate .htaccess...\e[0m"
# Update .htaccess files for local development (32bit OS... *rolls eyes at doostin*)
find public_html -name ".htaccess" -type f -exec sed -i 's/FollowSymLinks/SymLinksIfOwnerMatch/g' {} ";"
echo -e "\e[32mSetup permissions...\e[0m"
# Final permission change
chown -R $sitename:$sitename public_html/*
chmod -R 755 public_html/*
chmod 775 public_html/sites/default/files
chmod 755 public_html/sites/default/settings.php
chmod 755 public_html/sites/default/
cd public_html
echo -e "\e[32mRun Cron...\e[0m"
drush cron all
#echo -e "\e[32mSetting up theme...\e[0m"
# Run theme generator as site user for proper permissions, setup theme with sitename, install gulp and bundle gems, set theme default.
#runuser -l $sitename -c 'name=${PWD##*/} && cd /home/$name/public_html/sites/all/themes/ && echo -e "n${name}_theme\n\n \27\n yes" | yo aurora'
#&& echo -e " \27" | yo aurora:extras
#drush vset theme_default $sitename_theme -y
#cd /home/$sitename/public_html/sites/all/themes/$sitename_theme && echo 'gem "sass-globbing"' >> Gemfile &&
# echo 'require "sass-globbing"' >> config.rb && bundle install
#echo -e "\e[32mStarting gulp\e[0m"
#gulp serve
#echo -e "\e[32mRun 'gulp serve' after this completes\e[0m"
#echo -e " "
#echo -e " "
#echo -e "\e[32m--DOCUMENTATION--\e[0m"
#echo -e " "
#echo -e "\e[32mModular Scale (https://github.com/Team-Sass/modular-scale)\e[0m"
#echo -e " "
#echo -e "\e[32mSingularity Grids (https://github.com/Team-Sass/Singularity/wiki)\e[0m"
#echo -e " "
#echo -e "\e[32mBreakpoint (http://breakpoint-sass.com)\e[0m"
#echo -e " "
#echo -e "\e[32mToolkit (https://github.com/Team-Sass/toolkit)\e[0m"
#echo -e " "
#echo -e "\e[32mPlease note, sass-globbing is not included by default.\e[0m"
else
echo -e "\e[31mQuitting...\e[0m"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment