summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrikant Patnaik2015-02-03 13:30:32 +0530
committerSrikant Patnaik2015-02-03 13:30:32 +0530
commit47cfa40908970eddc39b36ec5ea27ebe3162df6e (patch)
treec79f05e92888c22b2e3369cd3d814c8a06a5066d
parent588aea91aaa5bb95a882f4937823b2ab389bb4a2 (diff)
downloadFOSSEE-netbook-tools-47cfa40908970eddc39b36ec5ea27ebe3162df6e.tar.gz
FOSSEE-netbook-tools-47cfa40908970eddc39b36ec5ea27ebe3162df6e.tar.bz2
FOSSEE-netbook-tools-47cfa40908970eddc39b36ec5ea27ebe3162df6e.zip
[NOT IMP] Error handling in check connectivity
-rwxr-xr-xpatcher.sh28
1 files changed, 17 insertions, 11 deletions
diff --git a/patcher.sh b/patcher.sh
index dce2c55..bd96aca 100755
--- a/patcher.sh
+++ b/patcher.sh
@@ -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