jprog/install.sh

71 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
INSTALLPATH="/usr/bin"
#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 [ "$?" = 1 ];then
# echo -e -n "\nJulia is not installed, proceed?(Y/n): "
# read confirm
#
# if [ "${confirm}" = "n" ];then
# exit 0;
# fi
#fi
function checkInstall() {
if [ -f ${INSTALLPATH}/jprog ];then
echo -e "\nJprog is successfully installed!\n"
else
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