10-mysql.sh 296 Bytes
#!/bin/bash

set -e
data_dir=/var/lib/mysql

if [[ -d $data_dir ]]; then
	declare -a files=(
		$(find "$data_dir" -mindepth 1 -maxdepth 1 -not -name lost+found 2>/dev/null)
	)
	if [[ ${#files[*]} -eq 0 ]]; then
		tar -zxf /var/lib/docker-init/data/mysql-server.data.tar.gz -C "$data_dir"
	fi
fi