lib.sh: Add check_internet

extramodules
Jesus Alvarez 9 years ago
parent 38fd9d69fe
commit 154a0b3b6e
  1. 8
      build.sh
  2. 7
      scraper.sh
  3. 6
      testing/test.sh
  4. 13
      verifier.sh

@ -296,6 +296,14 @@ if [[ ${#commands[@]} -eq 0 || ${mode} == "" ]]; then
fi
# Check for internet (thanks Comcast!)
# Please thank Comcast for this requirement...
if ! check_internet; then
error "Could not reach google dns server! (No internet?)"
exit 155
fi
msg "$(date) :: ${script_name} started..."

@ -39,6 +39,13 @@ usage() {
}
# Check for internet (thanks Comcast!)
if ! check_internet; then
error "Could not reach google dns server! (No internet?)"
exit 155
fi
for (( a = 0; a < $#; a++ )); do
if [[ ${args[$a]} == "-n" ]]; then
dry_run=1

@ -122,16 +122,18 @@ fi
# Check for internet (thanks Comcast!)
if [[ $(ping -w 1 -c 1 8.8.8.8 &> /dev/null; echo $?) != 0 ]]; then
if ! check_internet; then
error "Could not reach google dns server! (No internet?)"
exit 1;
exit 155
fi
if [[ ${EUID} -ne 0 ]]; then
error "This script must be run as root."
exit 1;
fi
if [[ "${test_mode}" != "" ]]; then
msg "Building arch base image"

@ -72,16 +72,17 @@ compute_remote_repo_hash() {
}
msg "$(date) :: ${script_name} started..."
# Bail if no internet
# Check for internet (thanks Comcast!)
# Please thank Comcast for this requirement...
if [[ $(ping -w 1 -c 1 8.8.8.8 &> /dev/null; echo $?) != 0 ]]; then
exit 0;
if ! check_internet; then
error "Could not reach google dns server! (No internet?)"
exit 155
fi
msg "$(date) :: ${script_name} started..."
has_error=0
local_repo_hash=""
remote_repo_hash=""

Loading…
Cancel
Save