Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohankumargupta/cc14f2c346577536b31323b2af2a0434 to your computer and use it in GitHub Desktop.
Save mohankumargupta/cc14f2c346577536b31323b2af2a0434 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#apt-get -y install php5-cli php5-gd php5-curl php5-mysql git
#set -x
disown >/dev/null 2>/dev/null
ps aux|grep php|head -n -1|cut -f6 -d' '| xargs -I {} kill {}
if [ -z "$1" ];
then
echo "Must enter a project name"
exit 1
fi
if [ -d "$1" ];
then
echo "The directory name already exists. Overwrite? (y/n) default n:"
read response
if [ -z $response ] || [ $response != "y" ];
then
exit 0
else
cd "$1"
echo "Dropping exisiting tables from db"
sudo service mysql start
drupal database:drop --no-interaction 1>/dev/null 2>&1
sudo service mysql stop
cd ..
echo "Removing directory: $1"
rm -rf "$1"
fi
fi
export COMPOSER_PROCESS_TIMEOUT=6000
#composer clear-cache
composer create-project drupal-composer/drupal-project:8.x-dev "$1" --stability dev --no-interaction
cd "$1"
drupal init --override --no-interaction
sudo service mysql restart
sleep 10
dbname=echo "$1" | sed 's/[\.|-]//g'
drupal site:install \
--langcode="en" \
--db-type="mysql" --db-host="127.0.0.1" --db-name="$dbname" \
--db-user="root" --db-pass="password" --db-port="3307" \
--site-name="drupal824" --site-mail="a@b.com" \
--account-name="admin" --account-mail="a@b.com" --account-pass="password" \
--force --no-interaction \
standard
(drupal server & 2>&1) 1>/dev/null
sleep 20
echo -e "\n"
echo -e "0\n" | drupal config:override system.performance js.preprocess 0
echo -e "0\n" | drupal config:override system.performance css.preprocess 0
drupal module:install hal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment