pre_install() {
	if [[ $INSTALL_TSOCKS == true ]]; then
		# tsocks package is not available in latest fedora releases, so don't exit in case
		# installation failed.
		install tsocks || echo "Installation of the tsocks package failed, proxy may not be available"
	fi

	if [[ $ID == centos || $ID == rocky ]] && [[ $VERSION_ID == 8* ]]; then
		sudo "$package_manager" update -y --refresh
	elif [[ $ID == centos ]] && ((VERSION_ID == 7)); then
		install nbd || {
			install wget
			wget -O nbd.rpm https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/n/nbd-3.24-1.el7.x86_64.rpm
			install nbd.rpm
		}
	fi
}

# Add packages for TLS testing against kernel
# Limited to fedora as testing is still marked as experimental
# and need a relatively fresh kernel to work with this tooling
if [[ $ID == fedora ]] && ((VERSION_ID >= 38)); then
	packages+=(ktls-utils)
	packages+=(nvmetcli)
fi
