Changed escape codes to make terminal colors work on MacOS

pull/76/head
Piero Toffanin 2016-12-29 16:15:59 -05:00
rodzic e6d6c855ca
commit f4df6eb4f7
2 zmienionych plików z 9 dodań i 9 usunięć

Wyświetl plik

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
echo -e "\e[92m" echo -e "\033[92m"
echo " _ __ __ ____ ____ __ ___" echo " _ __ __ ____ ____ __ ___"
echo "| | / /__ / /_ / __ \/ __ \/ |/ /" echo "| | / /__ / /_ / __ \/ __ \/ |/ /"
echo "| | /| / / _ \/ __ \/ / / / / / / /|_/ / " echo "| | /| / / _ \/ __ \/ / / / / / / /|_/ / "
echo "| |/ |/ / __/ /_/ / /_/ / /_/ / / / / " echo "| |/ |/ / __/ /_/ / /_/ / /_/ / / / / "
echo "|__/|__/\___/_.___/\____/_____/_/ /_/ " echo "|__/|__/\___/_.___/\____/_____/_/ /_/ "
echo echo
echo -e "\e[39m" echo -e "\033[39m"
almost_there(){ almost_there(){
echo echo
@ -20,7 +20,7 @@ almost_there(){
python -c "import sys;ret = 1 if sys.version_info <= (3, 0) else 0;print('Checking python version... ' + ('3.x, good!' if ret == 0 else '2.x'));sys.exit(ret);" python -c "import sys;ret = 1 if sys.version_info <= (3, 0) else 0;print('Checking python version... ' + ('3.x, good!' if ret == 0 else '2.x'));sys.exit(ret);"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
almost_there almost_there
echo -e "\e[33mYour system is currently using Python 2.x. You need to install or configure your system to use Python 3.x. Check out http://docs.python-guide.org/en/latest/dev/virtualenvs/ for information on how to setup Python 3.x alongside your Python 2.x install.\e[39m" echo -e "\033[33mYour system is currently using Python 2.x. You need to install or configure your system to use Python 3.x. Check out http://docs.python-guide.org/en/latest/dev/virtualenvs/ for information on how to setup Python 3.x alongside your Python 2.x install.\033[39m"
echo echo
exit exit
fi fi
@ -29,7 +29,7 @@ fi
python -c "import sys;import re;import subprocess;version = subprocess.Popen([\"gdalinfo\", \"--version\"], stdout=subprocess.PIPE).communicate()[0].decode().rstrip();ret = 0 if re.compile('^GDAL [2-9]\.[1-9]+').match(version) else 1; print('Checking GDAL version... ' + ('{}, excellent!'.format(version) if ret == 0 else version));sys.exit(ret);" python -c "import sys;import re;import subprocess;version = subprocess.Popen([\"gdalinfo\", \"--version\"], stdout=subprocess.PIPE).communicate()[0].decode().rstrip();ret = 0 if re.compile('^GDAL [2-9]\.[1-9]+').match(version) else 1; print('Checking GDAL version... ' + ('{}, excellent!'.format(version) if ret == 0 else version));sys.exit(ret);"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
almost_there almost_there
echo -e "\e[33mYour system is currently using a version of GDAL that is too old, or GDAL is not installed. You need to install or configure your system to use GDAL 2.1 or higher. If you have installed multiple versions of GDAL, make sure the newer one takes priority in your PATH environment variable.\e[39m" echo -e "\033[33mYour system is currently using a version of GDAL that is too old, or GDAL is not installed. You need to install or configure your system to use GDAL 2.1 or higher. If you have installed multiple versions of GDAL, make sure the newer one takes priority in your PATH environment variable.\033[39m"
echo echo
exit exit
fi fi

Wyświetl plik

@ -26,10 +26,10 @@ usage(){
} }
check_command(){ check_command(){
check_msg="\e[92m\e[1m OK\e[0m\e[39m" check_msg="\033[92m\033[1m OK\033[0m\033[39m"
hash $1 2>/dev/null || not_found=true hash $1 2>/dev/null || not_found=true
if [[ $not_found ]]; then if [[ $not_found ]]; then
check_msg="\e[91m can't find $1! Check that the program is installed before launching WebODM. $2\e[39m" check_msg="\033[91m can't find $1! Check that the program is installed before launching WebODM. $2\033[39m"
fi fi
echo -e "Checking for $1... $check_msg" echo -e "Checking for $1... $check_msg"
@ -42,8 +42,8 @@ environment_check(){
check_command "docker" "https://www.docker.com/" check_command "docker" "https://www.docker.com/"
check_command "git" "https://git-scm.com/downloads" check_command "git" "https://git-scm.com/downloads"
check_command "python" "https://www.python.org/downloads/" check_command "python" "https://www.python.org/downloads/"
check_command "pip" "Run \e[1msudo easy_setup pip\e[0m" check_command "pip" "Run \033[1msudo easy_install pip\033[0m"
check_command "docker-compose" "Run \e[1mpip install docker-compose\e[0m" check_command "docker-compose" "Run \033[1mpip install docker-compose\033[0m"
} }
run(){ run(){
@ -60,7 +60,7 @@ rebuild(){
run "rm -fr node_modules/" run "rm -fr node_modules/"
run "rm -fr nodeodm/external/node-OpenDroneMap" run "rm -fr nodeodm/external/node-OpenDroneMap"
run "docker-compose build --no-cache" run "docker-compose build --no-cache"
echo -e "\e[1mDone!\e[0m You can now start WebODM by running ./$0 start" echo -e "\033[1mDone!\033[0m You can now start WebODM by running ./$0 start"
} }
if [[ $1 = "start" ]]; then if [[ $1 = "start" ]]; then