#not yet used.
MAJ=5.7
VER=5.7.44
REL=1
#TYPE=linux_glibc2.5

CWD=`pwd`

#https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
#https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.20-1.el6.x86_64.rpm

WGET_OPTION=--no-check-certificate

#must alrady be cd to the current folder to be saved to.
. ./get_file.sh

grab()
{
	OS=$1
	BIT=$2
	RPM_LIST=${3}.txt

	#https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-1.el6.${BIT}.rpm-bundle.tar
	#https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.20-1.el6.${BIT}.rpm-bundle.tar.md5
	F=mysql-${VER}-${REL}.${OS}.${BIT}.rpm-bundle.tar

	U=https://dev.mysql.com/get/Downloads/MySQL-${MAJ}/$F
	O=$F
	M=https://cdn.mysql.com/Downloads/MySQL-${MAJ}/$F.md5

	#wget $WGET_OPTION -O 64-bit/${MAJ}/$VER/$F https://dev.mysql.com/get/Downloads/MySQL-${MAJ}/$F
	get_file $U $O $M

	#if md5 and md5 failed, it wouldn't get this far.

	tar xvf $O --no-same-owner

	rm -f mysql-community-test*

	ls *${OS}.${BIT}.rpm > ${RPM_LIST}

	rm -f $O $O.md5
}

doMain()
{
	cd ${CWD}/${MAJ}/${VER}/64-bit
	grab el7 x86_64 centos7-64
}

mkdir -p ${MAJ}/${VER}/64-bit

doMain
