summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrikant Patnaik2015-02-04 15:02:53 +0530
committerSrikant Patnaik2015-02-04 15:02:53 +0530
commit4be2c94c0aa5d6751a1abcb7f56d81bd5447334b (patch)
tree77174593fb823031bf7b7ae70f6063f89040909e
parent87c621baebdb4c2d0f133ce663549620c7022cbe (diff)
downloadFOSSEE-netbook-patcher-4be2c94c0aa5d6751a1abcb7f56d81bd5447334b.tar.gz
FOSSEE-netbook-patcher-4be2c94c0aa5d6751a1abcb7f56d81bd5447334b.tar.bz2
FOSSEE-netbook-patcher-4be2c94c0aa5d6751a1abcb7f56d81bd5447334b.zip
Doing local decoration, default git pull now
-rwxr-xr-xpatcher.sh49
1 files changed, 29 insertions, 20 deletions
diff --git a/patcher.sh b/patcher.sh
index bd96aca..2204fcc 100755
--- a/patcher.sh
+++ b/patcher.sh
@@ -1,35 +1,44 @@
#!/bin/bash
+
+export supertitle="FOSSEE Netbook Updates"
source easybashgui
+selected_update=''
+
+generic_return_code='Working offline. Select Ok to continue.'
+return_code_1="Unknown error occured. $generic_return_code"
+return_code_3="File I/0 error. $generic_return_code"
+return_code_4="Network failure. Unable to connect internet. $generic_return_code"
+return_code_5="SSL verification failure. Check system date. $generic_return_code"
+return_code_7="Protocol error. $generic_return_code"
+return_code_8="Server error. $generic_return_code"
+#The for loop may break in most of the time, unless there is an error in fossee.in
function check_internet() {
+ #wait_for "Checking internet"
for each in {fossee.in,github.com};
do
wget $each/robots.txt &> /dev/null
- # 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
+ return_code=$?
+ [ $return_code -eq 0 ] && list_updates && exit 0
+ [ $return_code -eq 1 ] && alert_message $return_code_1 && break
+ [ $return_code -eq 3 ] && alert_message $return_code_3 && break
+ [ $return_code -eq 4 ] && alert_message $return_code_4 && break
+ [ $return_code -eq 5 ] && alert_message $return_code_5 && break
+ [ $return_code -eq 7 ] && alert_message $return_code_7 && break
done
-
- [ $return_code -eq 8 ] && alert_message 'Server error. Working offline. Select Ok to continue.'
+ [ $return_code -eq 8 ] && alert_message $return_code_8
}
+
#fetch updates from github and show
-function fetch_updates() {
- UPDATES=$(git fetch &> /dev/null && \
- comm --nocheck-order -3 \
- <(git log --all --pretty="%H")\
- <(git log --pretty="%H"))
- git show -s --format=%B $UPDATES
+function list_updates() {
+ git log --format=%h\;\[%ar\]\;%s HEAD > /tmp/1 #make a local copy for editing
+ selected_update=$(menu -w 900 -h 500 "$(git pull >/dev/null && git log --format=\[%ar\]\ \ \ %s\ \[%h\] HEAD)" 2>&1)
+ selected_commit_hash=$(echo $selected_update | rev | cut -c -9 | rev | tr -d '[|]')
+ echo $selected_commit_hash
}
-
-
-check_internet
-fetch_updates
+#Function call
+check_internet #if success, it call fetch_updates(), else call list_updates()