diff --git a/install/50_opengeode.sh b/install/50_opengeode.sh index e6000ac37bf056b7948e8807bceb57c6c8653fa5..eb400a010b6b11a869a1f283b3ff33260e434a4b 100755 --- a/install/50_opengeode.sh +++ b/install/50_opengeode.sh @@ -2,7 +2,24 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . ${DIR}/common.sh +# Setup opengeode in ~/.local/bin cd $DIR/../opengeode || exit 1 + +# Skip install if the version installed is the same and the tree is clean +HEAD="$(grep _version_ opengeode/opengeode.py | head -1 | awk -F\' '{print $2}')" + +VERSION_INSTALLED="$(opengeode --version 2>&1)" +git status >/dev/null +TREE_CLEAN=$? +if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then + echo OpenGEODE tree is clean and already installed. Skipping OpenGEODE install... + exit 0 +fi + +# Unfortunately, the --upgrade DOES NOT ALWAYS WORK. +# Uninstall first... +echo y | pip2 uninstall opengeode + pip2 install --user --upgrade . || exit 1 # Add .local/bin to PATH