#!/bin/bash
# This script installs Python3 and Java 8

# Set PATH to something useful
PATH="/usr/local/sbin:/usr/local/bin:/usr/gnu/bin:/sbin:/bin:/usr/sbin:/usr/bin"

# Check if Python3 and Java are installed
python3=`which "python3" 2>/dev/null`
java=`which "java" 2>/dev/null`

if [ "$python3" = "" ]; then
	echo "Installing Python3"
	sudo yum -y install python3 python3-libs python3-setuptools python3-pip
	stat=$?
	
	if [ $stat -gt 0 ]; then
		echo "Installing Python3 failed."
		exit 1
	fi
fi

if [ "$java" = "" ]; then
	echo "Installing Java"
	sudo yum -y install java-1.8.0-openjdk
	stat=$?
	
	if [ $stat -gt 0 ]; then
		echo "Installing Java failed."
		exit 2
	fi
fi

