jprog/install.sh

72 lines
1.5 KiB
Bash
Raw Normal View History

2018-06-12 17:53:30 -07:00
#!/bin/bash
2018-06-14 23:09:23 -07:00
INSTALLPATH="/usr/local/bin"
2018-06-12 17:53:30 -07:00
which ()
{
(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
}
export -f which
which julia &> /dev/null
if [ $? != 0 ];then
echo -e -n "\nJulia is not installed, proceed?(Y/n): "
read confirm
if [ "${confirm}" = "n" ];then
exit 0;
fi
fi
2018-06-14 23:09:23 -07:00
function checkInstall() {
if [ -f ${INSTALLPATH}/jprog ];then
echo -e "\nJprog is successfully installed!\n"
2018-06-12 17:53:30 -07:00
else
2018-06-14 23:09:23 -07:00
echo -e "\nCould not install, check permissions!\n"
fi
}
function installProcess() {
if [ ! -f ${INSTALLPATH}/jprog ];then
echo -e -n "\nDo you want to install jprog to ${INSTALLPATH}?(Y/n): "
read doinstall
if [ "${doinstall}" = "y" ];then
echo -e "\nInstalling jprog to ${INSTALLPATH}...\n"
sudo cp -v src/jprog.jl ${INSTALLPATH}/jprog
checkInstall
elif [ "${doinstall}" = "n" ];then
exit 0;
else
echo -e "\nPlease enter y or n ...\n"
fi
elif [ -f ${INSTALLPATH}/jprog ];then
echo -e -n "Jprog is already installed, reinstall?(Y/n): "
read reinstall
if [ "${reinstall}" = "y" ];then
echo -e "\nRe-installing jprog to ${INSTALLPATH}...\n"
sudo cp -v src/jprog.jl ${INSTALLPATH}/jprog
checkInstall
elif [ "${reinstall}" = "n" ];then
exit 0;
else
echo -e "Please enter y or n ...\n"
fi
fi
}
installProcess