#!/bin/sh
#
# Univention Join Hook
#  ensures only systems with a certain UCS version can join into the domain
#
# SPDX-FileCopyrightText: 2020-2025 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only

eval "$(univention-config-registry shell version/version version/patchlevel)"

required_version="5.0-7"

if dpkg --compare-versions "${version_version}-${version_patchlevel}" lt "$required_version"; then
	echo
	echo '********************************************************************************'
	echo "This system does not meet the minimum UCS version to join this domain."
	echo "The join attempt is therefore aborted at this point."
	echo "Please upgrade your system to UCS ${required_version} before joining into this domain."
	echo '********************************************************************************'
	echo
	exit 1
fi

exit 0
