From d083448cc9007260d8fe168dce6c539cc8626587 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 23 Feb 2024 18:10:27 +0100 Subject: [PATCH] directus db 4 --- install.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 56a4c57..0ac042b 100644 --- a/install.sh +++ b/install.sh @@ -132,7 +132,6 @@ if [[ "$answer" == "y" ]]; then expect eof ") echo "${SECURE_MYSQL}" - apt -y purge expect # https://gist.github.com/coderua/5592d95970038944d099 fi @@ -153,17 +152,20 @@ if [[ "$answer" == "y" ]]; then echo fi install_expect - spawn mariadb -u root -p - expect "Enter password:" - send "$db_root_password\r" - expect "mysql>" - send "CREATE USER 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r" - send "CREATE DATABASE directus;\r" - send "GRANT ALL PRIVILEGES ON directus.* TO 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r" - send "FLUSH PRIVILEGES;\r" - expect "mysql>" - send "exit\r" - wait + CREATE_DIRECTUS_DB=$(expect -c " + spawn mariadb -u root -p + expect \"Enter password:\" + send \"$db_root_password\r\" + expect \"mysql>\" + send \"CREATE USER 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r\" + send \"CREATE DATABASE directus;\r\" + send \"GRANT ALL PRIVILEGES ON directus.* TO 'directus'@'localhost' IDENTIFIED BY '${db_directus_password}';\r\" + send \"FLUSH PRIVILEGES;\r\" + expect \"mysql>\" + send \"exit\r\" + wait + ") + echo "${CREATE_DIRECTUS_DB}" fi