add checks and confirm, to installer.

This commit is contained in:
mollusk 2018-06-14 23:09:23 -07:00
parent 8cecafcce0
commit ae67c28bdf

View File

@ -1,5 +1,5 @@
#!/bin/bash
INSTALLPATH="/usr/local/bin"
which ()
{
@ -18,9 +18,54 @@ if [ $? != 0 ];then
fi
fi
sudo cp -v src/jprog.jl /usr/local/bin/jprog
if [ ! -f /usr/local/bin/jprog ];then
echo -e "/nUnable to install, please check permissions...\n"
function checkInstall() {
if [ -f ${INSTALLPATH}/jprog ];then
echo -e "\nJprog is successfully installed!\n"
else
echo -e "Jprog is successfully installed!\n"
fi
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