2018-01-19 15:50:15 +01:00
|
|
|
#!/bin/sh
|
2018-10-28 16:04:11 +01:00
|
|
|
set -ev
|
2018-01-19 15:50:15 +01:00
|
|
|
|
2018-10-26 15:02:11 +02:00
|
|
|
cd $(realpath $(dirname "${0}"))/install
|
2018-01-19 15:50:15 +01:00
|
|
|
|
|
|
|
# Create MariaDB instance
|
2018-01-27 14:13:59 +01:00
|
|
|
mkdir -p /srv/mariadb/conf /srv/mariadb/data
|
2018-01-19 15:50:15 +01:00
|
|
|
chown 3306:3306 /srv/mariadb/data
|
2019-02-27 13:46:24 +01:00
|
|
|
lxc-execute mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --skip-test-db
|
2018-01-19 15:50:15 +01:00
|
|
|
|
|
|
|
# Configure MariaDB
|
2018-10-25 22:22:36 +02:00
|
|
|
cp srv/mariadb/conf/my.cnf /srv/mariadb/conf/my.cnf
|
2018-01-19 15:50:15 +01:00
|
|
|
|
|
|
|
# Enable query logging. Only if the DEBUG environment variable is set
|
|
|
|
if [ ${DEBUG:-0} -eq 1 ]; then
|
2018-01-27 14:13:59 +01:00
|
|
|
sed -i 's/#general_log/general_log/g' /srv/mariadb/conf/my.cnf
|
2018-01-19 15:50:15 +01:00
|
|
|
fi
|
|
|
|
|
2018-09-13 15:50:30 +02:00
|
|
|
# Install service
|
2018-10-25 22:22:36 +02:00
|
|
|
cp etc/init.d/mariadb /etc/init.d/mariadb
|
2018-09-13 15:50:30 +02:00
|
|
|
rc-update -u
|