jitty-scripts/julia-installer.sh

107 lines
2.1 KiB
Bash
Raw Normal View History

2015-08-08 21:04:55 -07:00
#!/bin/bash
2016-07-13 01:29:38 -07:00
VERSION="0.4.6"
2015-08-08 21:04:55 -07:00
DOWN_DIR="/tmp"
2016-07-13 01:29:38 -07:00
VPATH="0.4"
OUTNAME="julia-${VERSION}"
2015-08-08 21:04:55 -07:00
ARC=$(getconf LONG_BIT)
PACKAGE64="julia-${VERSION}-linux-x86_64.tar.gz"
PACKAGE32="julia-${VERSION}-linux-i686.tar.gz"
if [[ $EUID -ne 0 ]]; then
echo "You are not root!" 1>&2
exit 1
fi
downLoad()
{
if [ $ARC = "64" ];then
2016-07-13 01:29:38 -07:00
wget https://julialang.s3.amazonaws.com/bin/linux/x64/${VPATH}/julia-${VERSION}-linux-x86_64.tar.gz -P ${DOWN_DIR}
2015-08-08 21:04:55 -07:00
elif [ $ARC = "32" ];then
2016-07-13 01:29:38 -07:00
wget https://julialang.s3.amazonaws.com/bin/linux/x86/${VPATH}/julia-${VERSION}-linux-i686.tar.gz -P ${DOWN_DIR}
2015-08-08 21:04:55 -07:00
fi
}
extrPack()
{
if [ -f ${DOWN_DIR}/${PACKAGE64} ];then
mkdir ${DOWN_DIR}/${OUTNAME}
tar xvzf ${DOWN_DIR}/${PACKAGE64} -C ${DOWN_DIR}/${OUTNAME} --strip-components=1
2015-08-08 21:04:55 -07:00
elif [ -f ${DOWN_DIR}/${PACKAGE32} ];then
mkdir ${DOWN_DIR}/${OUTNAME}
tar xvzf ${DOWN_DIR}/${PACKAGE32} - C ${DOWN_DIR}/${OUTNAME} --strip-components=1
2015-08-08 21:04:55 -07:00
fi
}
installJulia()
{
cd ${DOWN_DIR}/${OUTNAME}
2015-08-08 21:04:55 -07:00
cp -v -R bin/* /usr/bin/
cp -v -R etc/* /etc/
echo "hi"
cp -v -R include/* /include/
cp -v -R lib/* /lib
cp -v -R share/* /usr/share
cd ${DOWN_DIR}/${OUTNAME}
2015-08-08 21:04:55 -07:00
cp -v -R bin/* /usr/bin/
cp -v -R etc/* /etc/
cp -v -R include/* /include/
cp -v -R lib/* /lib
cp -v -R share/* /usr/share
}
removeJulia()
{
rm -v -R /usr/bin/julia
rm -v -R /usr/bin/julia-debug
rm -v -R /usr/include/julia
rm -v -R /usr/lib/julia
rm -v -R /etc/julia
rm -v -R /usr/share/julia
}
main()
{
clear
echo "=========================="
echo " JULIA INSTALLER"
echo "=========================="
echo
echo "[1] - Install"
echo "[2] - Remove"
echo
echo "[q] - Quit"
echo
echo -n "-> "
read choice
if [ ${choice} = "1" ];then
downLoad
extrPack
installJulia
echo
echo -n "Would you like to run Julia now (y/n)?: "
read runjul
if [ ${runjul} = "y" ];then
julia
exit 0;
elif [ ${runjul} = "n" ];then
exit 0;
fi
elif [ ${choice} = "2" ];then
removeJulia
exit 0;
elif [ ${choice} = "q" ];then
exit 0;
fi
}
main