63 lines
1.6 KiB
Bash
Executable file
63 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
drupal_mail=dio@ca.ne
|
|
drupal_password=porcoddio
|
|
drupal_path=/var/www/d8/
|
|
drupal_db_name=www
|
|
drupal_db_user=www
|
|
drupal_hostname=www.example.com
|
|
drupal_db_password=$(pwgen -B 16 1)
|
|
|
|
. $(dirname $0)/../testingtoolchain/out.sh
|
|
conf=$(dirname $0)/../config.sh
|
|
[[ -f "$conf" ]] && . "$conf"
|
|
|
|
set -e
|
|
set -u
|
|
|
|
progress "setting up MariaDB"
|
|
pgrep -x mysqld || /etc/init.d/mysql start
|
|
for try in {1..20}; do # elegante!
|
|
if [[ -S /var/run/mysqld/mysqld.sock ]]; then
|
|
break
|
|
else
|
|
sleep 0.2
|
|
fi
|
|
done
|
|
if ! mysql -u root <<<'show databases;' | fgrep -v ${drupal_db_name}
|
|
then
|
|
#mysqladmin create "${drupal_db_name}"
|
|
mysql -u root <<EOF
|
|
CREATE USER '${drupal_db_user}'@'127.0.0.1' IDENTIFIED BY '${drupal_db_password}';
|
|
GRANT ALL PRIVILEGES ON ${drupal_db_name}.* TO '${drupal_db_user}'@'127.0.0.1';
|
|
EOF
|
|
fi
|
|
ok "MariaDB ready"
|
|
|
|
progress "Drush system-wide config"
|
|
mkdir -p /etc/drush/
|
|
cat <<EOF > /etc/drush/aliases.drushrc.php
|
|
<?php
|
|
\$aliases['www'] = array(
|
|
'root' => '${drupal_path}',
|
|
'uri' => 'http://${drupal_hostname}',
|
|
);
|
|
EOF
|
|
ok "Drush configurated"
|
|
|
|
progress "Download and install drupal8 'base'"
|
|
if [[ ! -d ${drupal_path} ]]; then
|
|
mkdir -p "$(dirname ${drupal_path})"
|
|
cd "$(dirname ${drupal_path})"
|
|
drush dl drupal --drupal-project-rename=$(basename ${drupal_path})
|
|
fi
|
|
cd "${drupal_path}"
|
|
note "Ci mette TANTO ma veramente!"
|
|
drush --yes site-install --locale=it \
|
|
--account-mail=${drupal_mail} \
|
|
--account-name=techbloc-admin \
|
|
--account-pass=${drupal_password} \
|
|
--db-su=root \
|
|
--db-url="mysql://${drupal_db_user}:${drupal_db_password}@localhost/${drupal_db_name}" \
|
|
standard
|
|
ok "Drupal is functional at ${drupal_path}"
|