Commit 8d2a377e authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Shellcheck pass - and use proper logic for git repo status check

parent 0a741877
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup the tools in ~/.local/bin
cd $DIR/../ocarina || exit 1
cd "$DIR/../ocarina" || exit 1
# Skip Ocarina building if tree is clean and version is identical
HEAD="$(git log --oneline | head -1 | cut -d' ' -f1)"
VERSION_INSTALLED="$(ocarina -v 2>&1 | grep ^Oca | awk '{print $NF}' | sed 's,),,;s,r,,')"
git status >/dev/null
TREE_CLEAN=$?
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo Ocarina tree is clean and already installed. Skipping Ocarina build...
exit 0
fi
make distclean # ignore any errors here
./support/reconfig || exit 1
./configure --prefix=${PREFIX} || exit 1
./configure --prefix="${PREFIX}" || exit 1
make || exit 1
make install
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup opengeode in ~/.local/bin
cd $DIR/../opengeode || exit 1
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
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo OpenGEODE tree is clean and already installed. Skipping OpenGEODE install...
exit 0
fi
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup pymsc in ~/.local
cd $DIR/../pymsc || exit 1
cd "$DIR/../pymsc" || exit 1
# Skip install if the version installed is the same and the tree is clean
HEAD="$(grep __version msccore/__init__.py | awk '{print $NF}' | tr -d '"')"
VERSION_INSTALLED="$(pip2 freeze | grep taste-msc | awk -F= '{print $NF}')"
git status >/dev/null
TREE_CLEAN=$?
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo taste-msc tree is clean and already installed. Skipping taste-msc install...
exit 0
fi
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup speedometer library in ~/.local
cd $DIR/../speedometer || exit 1
cd "$DIR/../speedometer" || exit 1
# Skip install if the version installed is the same and the tree is clean
HEAD="$(grep version speedometer/speedometer.py | head -1 | awk -F\" '{print $(NF-1)}')"
# This is much slower than a --version option would be...
# But there's no such functionality in speedometer :-(
VERSION_INSTALLED="$(pip2 freeze | grep speedometer | awk -F= '{print $NF}')"
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
git status >/dev/null
TREE_CLEAN=$?
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo Speedometer tree is clean and already installed. Skipping Speedometer install...
exit 0
fi
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup asn1valueEditor in ~/.local/bin
cd $DIR/../asn1-value-editor || exit 1
cd "$DIR/../asn1-value-editor" || exit 1
# Skip install if the version installed is the same and the tree is clean
HEAD="$(grep __version asn1_value_editor/asn1_value_editor.py | head -1 | awk -F\" '{print $(NF-1);}')"
VERSION_INSTALLED="$(taste-gui --version 2>&1 | head -1 | awk '{print $NF}')"
git status >/dev/null
TREE_CLEAN=$?
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo ASN.1 Value Editor tree is clean and already installed. Skipping asn1valueEditor install...
exit 0
fi
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup the tools in ~/.local/bin
cd $DIR/../msc-editor || exit 1
cd "$DIR/../msc-editor" || exit 1
# Skip install if the version installed is the same and the tree is clean
HEAD="$(grep __version msce/msce.py | head -1 | awk -F\' '{print $(NF-1)}')"
# This is much slower than a --version option would be...
# But there's no such functionality in msc-editor :-(
VERSION_INSTALLED="$(pip2 freeze | grep msce | awk -F= '{print $NF}')"
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
git status >/dev/null
TREE_CLEAN=$?
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo MSC editor tree is clean and already installed. Skipping MSCE install...
exit 0
fi
......
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh
. "${DIR}/common.sh"
# Setup the tools in ~/.local/bin
cd $DIR/../buildsupport || exit 1
cd "$DIR/../buildsupport" || exit 1
# Skip Ocarina building if tree is clean and version is identical
HEAD="$(git log --oneline | head -1 | cut -d' ' -f1)"
VERSION_INSTALLED="$(buildsupport -v 2>&1 | grep Version | cut -f 4 -d' ' | tr -d '\012')"
git status >/dev/null
TREE_CLEAN=$?
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
GIT_OUTPUT=$(git status --porcelain)
if [ "${GIT_OUTPUT}" == "" ] ; then
TREE_DIRTY=0
else
TREE_DIRTY=1
fi
if [ ${TREE_DIRTY} -eq 0 ] && [ "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
echo Buildsupport tree is clean and already installed. Skipping Buildsupport build...
exit 0
fi
make clean # ignore any errors here
make || exit 1
cp buildsupport ${PREFIX}/bin || exit 1
cp buildsupport "${PREFIX}/bin" || exit 1
# Add Ocarina to PATH
PATH_CMD='export PATH=$PATH:'"${PREFIX}/bin"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment