diff options
Diffstat (limited to 'lib/common-functions.sh')
-rw-r--r-- | lib/common-functions.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/common-functions.sh b/lib/common-functions.sh index 365f8e3f..2ace9970 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -257,3 +257,33 @@ function prompt_user { fi done } + +##checks if prefix exists in string +##params: string, prefix +##usage: contains_prefix "deploy_setting_launcher=1" "deploy_setting" +contains_prefix() { + local mystr=$1 + local prefix=$2 + if echo $mystr | grep -E "^$prefix.*$" > /dev/null; then + return 0 + else + return 1 + fi +} + +##verify internet connectivity +#params: none +function verify_internet { + if ping -c 2 $ping_site > /dev/null; then + if ping -c 2 www.google.com > /dev/null; then + echo "${blue}Internet connectivity detected${reset}" + return 0 + else + echo "${red}Internet connectivity detected, but DNS lookup failed${reset}" + return 1 + fi + else + echo "${red}No internet connectivity detected${reset}" + return 1 + fi +} |