Created
November 12, 2015 22:44
-
-
Save jbickar/3c38014c577b112bc6af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TODO Grunt this. | |
## If dir exists empty it. | |
if [ -d /Users/jbickar/Sites/$1 ]; then | |
cd /Users/jbickar/Sites/$1 | |
drush sql-drop -y | |
cd ../ | |
rm -Rf /Users/jbickar/Sites/$1 | |
fi | |
# Move to site root. | |
mkdir /Users/jbickar/Sites/$1 | |
cd /Users/jbickar/Sites/$1 | |
## Get resources from server. | |
drush -y rsync --include-conf @anc.$1 . | |
BUCKET="$(drush @anc.$1 vget s3fs_bucket | sed 's/s3fs_bucket\: \"//' | sed 's/\"//' | tr -d '\r\n' )" | |
# echo $BUCKET | |
# COMMAND="aws --profile anchorage s3 sync --recursive s3://$BUCKET/s3fs-private/ sites/default/files/private/" | |
# echo $COMMAND | |
# sleep 20 | |
aws --profile anchorage s3 cp --recursive s3://$BUCKET/s3fs-private/ sites/default/files/private/ | |
aws --profile anchorage s3 cp --recursive s3://$BUCKET/s3fs-public/ sites/default/files/ | |
# TODO: fix this. It is trying to create the DB regardless of whether it exists. | |
if ! mysql -u root -e 'use $1'; then | |
mysqladmin -u root -proot create $1 | |
fi | |
rm /Users/jbickar/Sites/$1/.htaccess | |
cp /Users/jbickar/Sites/drupal-7.41/.htaccess /Users/jbickar/Sites/$1/.htaccess | |
rm -Rf /Users/jbickar/Sites/$1/.git | |
rm /Users/jbickar/Sites/$1/sites/default/settings.local.php | |
mv /Users/jbickar/Sites/$1/sites/default/settings.php /Users/jbickar/Sites/$1/sites/default/settings.php.bak | |
cp /Users/jbickar/Sites/drupal-7.41/sites/default/default.settings.php /Users/jbickar/Sites/$1/sites/default/settings.php | |
printf "\n\$base_url = \"http://$1.dev\";\n" >> /Users/jbickar/Sites/$1/sites/default/settings.php | |
printf "\n\$databases['default']['default'] = array('driver' => 'mysql', 'database' => '$1', 'host' => 'localhost', 'username' => 'root', 'password' => 'root');\n" >> /Users/jbickar/Sites/$1/sites/default/settings.php | |
/Users/jbickar/dr5/drush -y sql-sync @anc.$1 @self | |
chmod -Rf 0755 ./ | |
chmod -Rf 0777 sites/default/files | |
drush sqlq 'update system set status=0 where name="simplesamlphp_auth"' | |
drush rr | |
drush vset file_default_scheme public | |
drush -y dis s3fs | |
drush cc all | |
drush upwd admin --password=admin | |
drush uli |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment