diff --git a/scripts/client-check-if-outdated.sh b/scripts/client-check-if-outdated.sh new file mode 100755 index 0000000..985d3da --- /dev/null +++ b/scripts/client-check-if-outdated.sh @@ -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 diff --git a/xiringuito b/xiringuito index 4f5979d..7d18f97 100755 --- a/xiringuito +++ b/xiringuito @@ -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))