#!/bin/bash

PVA_MN_CORE=0

function checkPrerequisites()
{
	rpm -qi virtuozzo-release || is_psbm
	if [ $? -ne 0 ]; then
		abort "Virtuozzo is not installed"
	else
		VZ_VERSION=`rpm -q --qf "%{version}" virtuozzo-release`
		if [[ "$VZ_VERSION" < "4.7.0" ]]; then
			abort "Virtuozzo is out of date. Please upgrade to Parallels Virtuozzo Containers 4.7"
		fi

		service vz status
		if [ $? -ne 0 ]; then
			abort "Virtuozzo is not running"
		fi
	fi
}

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

	checkPrerequisites

	date "+%b %e %T PVA Agent for Virtuozzo 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
