genericifying the drupal7 autobuild
[eostre.git] / drupal-automake-generic / files / do-mysql.sh
diff --git a/drupal-automake-generic/files/do-mysql.sh b/drupal-automake-generic/files/do-mysql.sh
new file mode 100644 (file)
index 0000000..350650d
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash -xe
+
+DRUPAL_DB_PASSWORD="H0z7WC8Xq8yRE"
+
+# install the mysql server
+apt install -y mariadb-server ||:
+# installation "fails" when working in a chroot
+# so we just ignore it
+# should work on a regular system, but this part can't be tested in a chroot
+
+# set up mysql with defaults
+mysql_secure_installation < /sqldefaults
+
+# add the drupal db
+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
+
+# make sure perms are right
+chown -R www-data:www-data /var/www/html