2019-06-10 16:50:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# detect CI
|
2020-02-16 18:01:40 +01:00
|
|
|
if [ "$SYSTEM_COLLECTIONID" != "" ]; then
|
2019-06-10 16:50:22 +02:00
|
|
|
# Azure Pipelines
|
|
|
|
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
|
2019-09-12 19:47:23 +02:00
|
|
|
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
|
|
|
|
elif [ "$HOME" != "" ]; then
|
|
|
|
# GitHub Actions
|
|
|
|
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
|
|
CI_BUILD_DIR="$GITHUB_WORKSPACE"
|
2019-06-10 16:50:22 +02:00
|
|
|
else
|
|
|
|
# for executing in non ci environment
|
|
|
|
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
|
|
fi
|
|
|
|
|
|
|
|
function installAndUpgrade()
|
|
|
|
{
|
|
|
|
arr=("$@")
|
|
|
|
for i in "${arr[@]}";
|
|
|
|
do
|
2020-12-20 13:59:49 +01:00
|
|
|
list_output=`brew list --formula | grep $i`
|
2019-06-10 16:50:22 +02:00
|
|
|
outdated_output=`brew outdated | grep $i`
|
|
|
|
|
|
|
|
if [[ ! -z "$list_output" ]]; then
|
|
|
|
if [[ ! -z "$outdated_output" ]]; then
|
2020-12-20 13:59:49 +01:00
|
|
|
echo "Outdated package: ${outdated_output}"
|
|
|
|
brew unlink ${outdated_output}
|
2019-06-10 16:50:22 +02:00
|
|
|
brew upgrade $i
|
2020-12-20 13:59:49 +01:00
|
|
|
brew link --overwrite $i
|
2019-06-10 16:50:22 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
brew install $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# install osx deps for hyperion compile
|
|
|
|
if [[ $CI_NAME == 'osx' || $CI_NAME == 'darwin' ]]; then
|
|
|
|
echo "Install dependencies"
|
|
|
|
brew update
|
|
|
|
dependencies=("qt5" "python" "libusb" "cmake" "doxygen")
|
|
|
|
installAndUpgrade "${dependencies[@]}"
|
|
|
|
fi
|