#!/bin/bash
# Copyright (C) 2000-2012 Synology Inc. All rights reserved.

Python27="/var/packages/Python"

Python3Scripts="$(dirname "$0")"
msg_file="$Python3Scripts/message_conflict"
msg_region="message_$SYNOPKG_DSM_LANGUAGE"

## Prepare the error message
message="$(grep "$msg_region" "$msg_file" | cut -d'=' -f2 | cut -d'"' -f2)"
if [ -z "$message" ]; then
	message="Before installing this package, please uninstall or update Python 2 to the newest version."
fi

## Check the version for python-2.7.x
if [ -e "$Python27" ]; then
	version=$(cat "$Python27/INFO" | grep version | sed 's/.*-0*\([1-9][0-9]*\)"/\1/')

	if [ "$version" -le 14 ]; then
		echo "$message" > "$SYNOPKG_TEMP_LOGFILE"
		exit 1
	fi
fi

exit 0
