ee2e4815a7b31a0f403cc3f7366f460d60d0c4eb
[eostre.git] / drupal-automake-generic / files / do-mysql.sh
1 #!/bin/bash -xe
2 . conf/conf
3
4 DRUPAL_DB_PASSWORD="${DRUPAL_DB_PASSWORD:-password}"
5
6 # install the mysql server
7 apt install -y mariadb-server ||:
8 # installation "fails" when working in a chroot
9 # so we just ignore it
10 # should work on a regular system, but this part can't be tested in a chroot
11
12 # set up mysql with defaults
13 mysql_secure_installation < /sqldefaults
14
15 # add the drupal db
16 mysql -u root -e "CREATE DATABASE $DRUPAL_DB_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
17 mysql -u root -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON $DRUPAL_DB_NAME.* TO '$DRUPAL_DB_USER'@'localhost' IDENTIFIED BY '$DRUPAL_DB_PASSWORD';"
18
19 ## and have drupal do the site-install
20 #cd /var/www/html
21 #vendor/bin/drush site-install --db-url=mysql://drupaluser:$DRUPAL_DB_PASSWORD@localhost/drupal
22
23 # make sure perms are right
24 chown -R www-data:www-data /var/www/html