#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)

ip route | awk '/default/ {print $3}' >/dev/null 2>&1
if [ ! $? = 0 ]
then
  echo false
  exit 1
else
  ping www.google.com -c1 -w1 >/dev/null 2>&1
  if [ ! $? = 0 ]
  then
    echo false
    exit 1
  else
    echo true
    exit 0
  fi
fi
