Add Mac compatibility to boulder-start

The version of sort that ships with OS X does not support the -V
version flag. Emulate that functionality with some sed-fu
This commit is contained in:
Brandon Kreisel 2015-09-27 14:44:00 -04:00
parent 5cc9061413
commit cbfdae88fc

View file

@ -4,11 +4,16 @@
# ugh, go version output is like:
# go version go1.4.2 linux/amd64
GOVER=`go version | cut -d" " -f3 | cut -do -f2`
GOVER=`go version | cut -d" " -f3 | cut -do -f2`
# version comparison
function verlte {
if [ `uname` == 'Darwin' ]; then
[ "$1" = "`echo -e \"$1\n$2\" | sed 's/\b\([0-9]\)\b/0\1/g' \
| sort | sed 's/\b0\([0-9]\)/\1/g' | head -n1`" ]
else
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
fi
}
if ! verlte 1.5 "$GOVER" ; then