summaryrefslogtreecommitdiff
path: root/patcher.sh
blob: dce2c55168e934f7a16797e40d669c0fe73326c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

INET_AVAILABLE=0

#<check internet> handles both network and internet availability
function check_internet() {
	for each in {fossee.in,spoken-tutorial.org}; 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
}

#<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
}


check_internet
fetch_updates