#!/bin/sh
active_removed_backend=""

if grep -qhriE "dbdriver.*=.*mysql" /etc/bareos/; then
	active_removed_backend="MySQL"
fi
if grep -qhriE "dbdriver.*=.*sqlite" /etc/bareos/; then
	active_removed_backend="$active_removed_backend SQLite"
fi

echo "You are currently using bareos with the $active_removed_backend" >&2
echo "catalog backend." >&2
echo "" >&2
echo "THIS IS NOT SUPPORTED ANYMORE" >&2
echo "" >&2
echo "Beginning with version 21.0.0 bareos has dropped support for" >&2
echo "MySQL and SQLite catalog backends." >&2
echo "" >&2
echo "To upgrade to bareos >=21.0.0 you need to migrate to PostgreSQL" >&2
echo "catalog backend using the 'bareos-dbcopy' tool of your current" >&2
echo "installation first." >&2
echo "" >&2
echo "current catalog backend not supported anymore" >&2

if $(apk info -qe bareos-webui); then
	for _ver in 81 82; do
		apk info -qe php$_ver-apache2 && \
		echo "!! Found php$_ver-apache2. This needs to be removed since apache2 " && \
		echo "!! with mod_php is no longer supported" && \
		echo "" && \
		echo "!! You should install php-fpm with:" && \
		echo "" && \
		echo "!! apk add php-fpm" && \
		echo "" >&2
	done
fi

exit 0
