#!/sbin/openrc-run

description="MariaDB docker container"

depend() {
	need docker
}

start() {
	/usr/bin/docker run -d --rm \
	--name mariadb \
	-h mariadb \
	-v /srv/mariadb/conf:/etc/mysql \
	-v /srv/mariadb/data:/var/lib/mysql \
	mariadb
}

start_post() {
	timeout -t 60 docker exec mariadb sh -c 'until [ -e /run/mysqld/mysqld.sock ]; do usleep 50000; done'
}

stop() {
	/usr/bin/docker stop mariadb
}
