Browse Source

Use curl for internet connection check, fixes #399

andryyy 8 years ago
parent
commit
716573520f
1 changed files with 8 additions and 8 deletions
  1. 8 8
      update.sh

+ 8 - 8
update.sh

@@ -1,7 +1,14 @@
 #!/bin/bash
 
+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
+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... "
-timeout 1 bash -c "echo >/dev/tcp/8.8.8.8/53"
+curl -o /dev/null google.com -sm3
 if [[ $? != 0 ]]; then
 	echo -e "\e[31mfailed\e[0m"
 	exit 1
@@ -9,13 +16,6 @@ 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
-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
-
 set -o pipefail
 export LC_ALL=C
 DATE=$(date +%Y-%m-%d_%H_%M_%S)