#!/bin/bash

PVA_MN_CORE=0

function checkPrerequisites()
{
	echo "Checking for Parallels Server presence"

	is_psbm
	if [ $? -ne 0 ]; then
		abort "Parallels Server is not installed"
	else
		VZ_VERSION=`rpm -q --qf "%{version}" parallels-server-bm-release`
		if [ "$VZ_VERSION" = "4.0.0" ]; then
			abort "Parallels Server Bare Metal 4 is not supported. Please upgrade to Parallels Server Bare Metal 5"
		fi
		VZ_VERSION=`rpm -q --qf "%{version}" parallels-server-bm-mac-release`
		if [ "$VZ_VERSION" = "4.0.0" ]; then
			abort "Parallels Server Bare Metal for Mac 4 is not supported. Please upgrade to Parallels Server Bare Metal for Mac 5"
		fi
	fi
}


function main() 
{
    echo "------------------------------------------------------------------------------------------------"
    date "+%b %e %T PVA Agent for Parallels Server pre upgrade configuration : start"

    checkPrerequisites

    date "+%b %e %T PVA Agent for Parallels Server pre upgrade configuration : stop"
    echo "------------------------------------------------------------------------------------------------"
}

###################### Include common files #######################

# VZL defines
scriptDir=`dirname "$0"`
# VZL defines
. ${scriptDir}/pva-agent-helper.sh || abort "Failed to include ${scriptDir}/pva-agent-helper.sh" 

############################### Go  ##############################

main $*

exit 0
