#!/bin/bash
#
#
# VI editor settings
# set shiftwidth=4
# set tabstop=4
# ==========================================================
# Title: Matlab FAST installer
# Author: Mike Gore
# Date: 15 Oct 2015 
# Tested with 14.04lts
# Notes:
#   Grabs a TAR file of an installed working matlab from ASIMOV and extracts it
# References: 
#   https://cs.uwaterloo.ca/twiki/view/CF/MatlabInstallation
# Usage:
#   ./fast_install_matlab R2015b
# ==========================================================


if [ $# -eq 1 ]
then
	RELEASE=$1
else
	echo Usage: $0 RELEASE 
	echo    RELEASE is the MATLAB release version like R2015a
	echo
	echo Example: $0 R2015a
	exit 1
fi

ARCH=`arch`
TARFILE=matlab-$RELEASE-$ARCH.tar.gz
rsync -a cscf-adm@asimov.uwaterloo.ca:/coregroup/images/packages/$TARFILE /tmp

echo MATLAB_PATH: $MATLAB_PATH
echo RELEASE:     $RELEASE
echo ARCH:        $ARCH
echo TAR File:    $TARFILE

cd /
tar xzf /tmp/$TARFILE
rm /tmp/$TARFILE