Merge pull request #27 from ivanilves/feature/check-if-outdated

Check, if we run OUTDATED version
This commit is contained in:
Ivan Ilves 2017-04-23 19:41:05 +02:00 committed by GitHub
commit d4772fd133
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#
# Check, if we are behind the latest master (and warn if we are)
#
set -e
git remote update >/dev/null
REMOTE_TS=$(git show --pretty="format:%ct" origin master)
LOCAL_TS=$(git show --pretty="format:%ct")
if [[ ${LOCAL_TS} -lt ${REMOTE_TS} ]]; then
echo "*** WARNING: You are running outdated Xiringuito version. Remember: 'git pull' FTW!"
fi

View File

@ -9,6 +9,7 @@ function print_help() {
echo
echo "OPTIONS"
echo "-f X fail connection after X ping failures"
echo "-C do not check if we run outdated app version"
echo "-R do not reconnect after connection failure"
echo "-D do not fetch DNS config from server"
echo "-h show this extremely helpful message"
@ -51,6 +52,9 @@ while getopts "f:RDrh" o; do
exit 1
fi
;;
C)
DONT_CHECK_IF_OUTDATED=true
;;
R)
NO_RECONNECT=true
;;
@ -70,6 +74,10 @@ while getopts "f:RDrh" o; do
esac
done
if [[ ! ${DONT_CHECK_IF_OUTDATED} ]]; then
./scripts/client-check-if-outdated.sh 2>/dev/null &
fi
declare -r MAX_FAILED_PINGS=${MAX_FAILED_PINGS-10}
shift $((OPTIND-1))