-
Notifications
You must be signed in to change notification settings - Fork 9
/
initiate.sh
executable file
·25 lines (25 loc) · 1014 Bytes
/
initiate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
if [ ! -f /var/www/sites/default/settings.php ]; then
# Start mysql
/usr/bin/mysqld_safe &
sleep 10s
# Generate random passwords
DRUPAL_DB="drupal"
MYSQL_PASSWORD=`pwgen -c -n -1 12`
DRUPAL_PASSWORD=`pwgen -c -n -1 12`
echo mysql root password: $MYSQL_PASSWORD
echo drupal password: $DRUPAL_PASSWORD
echo $MYSQL_PASSWORD > /mysql-root-password.txt
echo $DRUPAL_PASSWORD > /drupal-db-password.txt
mysqladmin -u root password $MYSQL_PASSWORD
mysql -uroot -p$MYSQL_PASSWORD -e "CREATE DATABASE drupal; GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY '$DRUPAL_PASSWORD'; FLUSH PRIVILEGES;"
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/sites-available/default
a2enmod rewrite vhost_alias
cd /var/www/
drush site-install standard -y --account-name=admin --account-pass=admin --db-url="mysqli://drupal:${DRUPAL_PASSWORD}@localhost:3306/drupal"
drush en drush_deployment -y
drush release-tag v1.4
killall mysqld
sleep 10s
fi
supervisord -n