Use curl for internet connection check, fixes #399

master
andryyy 2017-06-24 00:04:05 +02:00
parent 112e056fda
commit 716573520f
1 changed files with 9 additions and 9 deletions

View File

@ -1,14 +1,5 @@
#!/bin/bash
echo -en "Checking internet connection... "
timeout 1 bash -c "echo >/dev/tcp/8.8.8.8/53"
if [[ $? != 0 ]]; then
echo -e "\e[31mfailed\e[0m"
exit 1
else
echo -e "\e[32mOK\e[0m"
fi
if [[ -z $(which curl) ]]; then echo "Cannot find curl, exiting."; exit 1; fi
if [[ -z $(which docker-compose) ]]; then echo "Cannot find docker-compose, exiting."; exit 1; fi
if [[ -z $(which docker) ]]; then echo "Cannot find docker, exiting."; exit 1; fi
@ -16,6 +7,15 @@ if [[ -z $(which git) ]]; then echo "Cannot find git, exiting."; exit 1; fi
if [[ -z $(which awk) ]]; then echo "Cannot find awk, exiting."; exit 1; fi
if [[ -z $(which sha1sum) ]]; then echo "Cannot find sha1sum, exiting."; exit 1; fi
echo -en "Checking internet connection... "
curl -o /dev/null google.com -sm3
if [[ $? != 0 ]]; then
echo -e "\e[31mfailed\e[0m"
exit 1
else
echo -e "\e[32mOK\e[0m"
fi
set -o pipefail
export LC_ALL=C
DATE=$(date +%Y-%m-%d_%H_%M_%S)