diff options
author | Srikant Patnaik | 2015-02-03 13:30:32 +0530 |
---|---|---|
committer | Srikant Patnaik | 2015-02-03 13:30:32 +0530 |
commit | 47cfa40908970eddc39b36ec5ea27ebe3162df6e (patch) | |
tree | c79f05e92888c22b2e3369cd3d814c8a06a5066d | |
parent | 588aea91aaa5bb95a882f4937823b2ab389bb4a2 (diff) | |
download | FOSSEE-netbook-patcher-47cfa40908970eddc39b36ec5ea27ebe3162df6e.tar.gz FOSSEE-netbook-patcher-47cfa40908970eddc39b36ec5ea27ebe3162df6e.tar.bz2 FOSSEE-netbook-patcher-47cfa40908970eddc39b36ec5ea27ebe3162df6e.zip |
[NOT IMP] Error handling in check connectivity
-rwxr-xr-x | patcher.sh | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -1,21 +1,25 @@ #!/bin/bash +source easybashgui -INET_AVAILABLE=0 -#<check internet> handles both network and internet availability function check_internet() { - for each in {fossee.in,spoken-tutorial.org}; do + for each in {fossee.in,github.com}; + do wget $each/robots.txt &> /dev/null - return_code=$? - [ $return_code -eq 0 ] && INET_AVAILABLE=1 - [ $return_code -eq 4 ] && echo 'Please connect to internet!' - [ $return_code -eq 5 ] && echo 'Please check the system date!' - [ $return_code -eq 8 ] && echo 'Server error' - done - [ $INET_AVAILABLE -eq 0 ] && exit 0 + # return_code=$? + return_code=8 + [ $return_code -eq 0 ] && break + [ $return_code -eq 1 ] && alert_message 'Generic error occured. Working offline. Select Ok to continue.' && break + [ $return_code -eq 3 ] && alert_message 'File I/0 error. Check the permission of the present directory. Working offline. Select Ok to continue' && break + [ $return_code -eq 4 ] && alert_message 'Network failure. Unable to connect internet. Working offline. Select Ok to continue.' && break + [ $return_code -eq 5 ] && alert_message 'SSL verification failure. Check system date. Working offline. Select Ok to continue' && break + [ $return_code -eq 7 ] && alert_message 'Protocol error. Working offline. Select Ok to continue.' && break + done + + [ $return_code -eq 8 ] && alert_message 'Server error. Working offline. Select Ok to continue.' } -#<fetch updates> from github and show +#fetch updates from github and show function fetch_updates() { UPDATES=$(git fetch &> /dev/null && \ comm --nocheck-order -3 \ @@ -25,5 +29,7 @@ function fetch_updates() { } + + check_internet fetch_updates |