[Updated ] euphoria-install.sh: added dep checks and tmp cleaning
This commit is contained in:
parent
b6b8664297
commit
d8b21882e2
@ -7,10 +7,24 @@ state="beta2"
|
||||
arch="x64"
|
||||
fext="tar.gz"
|
||||
extcmd="tar"
|
||||
deps="curl"
|
||||
target_dir="/usr/local"
|
||||
url="http://nbtelecom.dl.sourceforge.net/project/rapideuphoria/Euphoria/${version}-${state}/${name}-${version}-Linux-${arch}-57179171dbed.${fext}"
|
||||
tmpdir="/tmp"
|
||||
|
||||
check_deps(){
|
||||
|
||||
get_path=$(which curl)
|
||||
|
||||
if [ ! ${get_path} ];then
|
||||
printf "Please install: ${deps}"
|
||||
exit 0;
|
||||
else
|
||||
printf "Deps passed checks..moving on\n"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
check_root(){
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
printf "${LRED}This script must be run as root${NC}\n" 1>&2
|
||||
@ -96,14 +110,39 @@ uninstall_pkg(){
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
remove_tmp(){
|
||||
echo
|
||||
printf "Do you want to remove ${tmpdir}/${name}-${version}-Linux-${arch} and ${tmpdir}/${name}-${version}.${fext}: "
|
||||
printf "[y/n]\n"
|
||||
read choice
|
||||
|
||||
if [ "${choice}" = "y" ];then
|
||||
rm -v -r ${tmpdir}/${name}-${version}-Linux-${arch}
|
||||
rm -v -r ${tmpdir}/${name}-${version}.${fext}
|
||||
if [ ! -d ${tmpdir}/${name}-${version}-Linux-${arch} ] && [ ! -f ${tmpdir}/${name}-${version}.${fext} ];then
|
||||
printf "${tmpdir} cleared\n"
|
||||
else
|
||||
printf "Failed to remove files\n"
|
||||
fi
|
||||
elif [ "${choice}" = "n" ];then
|
||||
printf "Exiting...\n"
|
||||
exit 0;
|
||||
else
|
||||
printf "Skipping and exiting...\n"
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
case $1 in
|
||||
install)
|
||||
check_root
|
||||
check_deps
|
||||
check_install
|
||||
download_pkgs
|
||||
extract_files
|
||||
install_build
|
||||
post_install
|
||||
remove_tmp
|
||||
;;
|
||||
uninstall)
|
||||
check_root
|
||||
|
Loading…
x
Reference in New Issue
Block a user