document conf/conf a bit
[eostre.git] / drupal-automake-generic / files / do-mysql.sh
CommitLineData
8b2413e8 1#!/bin/bash -xe
ddade72f 2
3# conf/conf contains some variables
26c6a7ba 4. conf/conf
8b2413e8 5
26c6a7ba 6DRUPAL_DB_PASSWORD="${DRUPAL_DB_PASSWORD:-password}"
8b2413e8 7
8# install the mysql server
9apt install -y mariadb-server ||:
10# installation "fails" when working in a chroot
11# so we just ignore it
12# should work on a regular system, but this part can't be tested in a chroot
13
14# set up mysql with defaults
15mysql_secure_installation < /sqldefaults
16
17# add the drupal db
26c6a7ba 18mysql -u root -e "CREATE DATABASE $DRUPAL_DB_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
19mysql -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';"
8b2413e8 20
21## and have drupal do the site-install
22#cd /var/www/html
23#vendor/bin/drush site-install --db-url=mysql://drupaluser:$DRUPAL_DB_PASSWORD@localhost/drupal
24
25# make sure perms are right
26chown -R www-data:www-data /var/www/html