10-postgresql.sh 306 Bytes
#!/bin/bash

set -e
data_dir=/var/lib/postgresql

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/postgresql-server.data.tar.gz -C "$data_dir"
	fi
fi