From d864e66d623c58a38c7063f038e1e6d3b1d52271 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 22:02:44 +0000 Subject: [PATCH] tagscript: add sanity checks on version number --- scripts/tagscript.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index faccf47081..4e74ebe9a5 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -45,6 +45,19 @@ fi eval $(parse_version "$1") ngrep () { (echo "$2" | grep -e "$1" >/dev/null); } +err () { echo "$1" >&2; exit 1; } + +ngrep '^[1-9]*$' "$gmajor" || \ + err "The major version '$gmajor' appears invalid." +ngrep '^[0-9]*$' "$gminor" || \ + err "The minor version '$gminor' appears invalid." +[ -z "$gmicro" ] || ngrep '^[0-9]*$' "$gmicro" || \ + err "The micro version '$gmicro' appears invalid." +[ -z "$grev" ] || ngrep '^[.-]' "$grev" || \ + err "The revision '$grev' appears invalid." + +echo "We're going to release freeswitch v$gver" >&2 +echo >&2 if ! ($debug || ngrep '-s' "$opts"); then cat >&2 <