#!/bin/bash -xe
-DRUPAL_DB_PASSWORD="please change me"
+DRUPAL_DB_PASSWORD="H0z7WC8Xq8yRE"
# install the mysql server
apt install -y mariadb-server ||:
mysql_secure_installation < /sqldefaults
# add the drupal db
-mysql -u root -p -e 'CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;'
-mysql -u root -p -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupal.* TO 'drupaluser'@'localhost' IDENTIFIED BY '$DRUPAL_DB_PASSWORD';"
+mysql -u root -p -e 'CREATE DATABASE dbd_drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;'
+mysql -u root -p -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON dbd_drupal.* TO 'w_dbd'@'localhost' IDENTIFIED BY '$DRUPAL_DB_PASSWORD';"
-# and have drupal do the site-install
-cd /var/www/html
-vendor/bin/drush site-install --db-url=mysql://drupaluser:$DRUPAL_DB_PASSWORD@localhost/drupal
+## and have drupal do the site-install
+#cd /var/www/html
+#vendor/bin/drush site-install --db-url=mysql://drupaluser:$DRUPAL_DB_PASSWORD@localhost/drupal
# make sure perms are right
chown -R www-data:www-data /var/www/html
mv composer.phar /usr/local/bin/composer
# use composer to install drush7 and the drush launcher
-cd /var/www/html
+cd /var/www
composer require drush/drush:8.*
wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
chmod +x drush.phar
mv drush.phar /usr/local/bin/drush
# use vendor/bin/drush to download drupal
-cd /var/www/html
+cd /var/www
vendor/bin/drush dl drupal-7
+
+# make drupal our webroot
+mv html html-stock
+ln -s drupal-7* html