Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions scripts/configure_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@ Options:

FORCE=false
while getopts ":sfh" opt; do
case ${opt} in
f ) FORCE=true
;;
h ) echo "${HELP}"
case ${opt} in
f)
FORCE=true
;;
h)
echo "${HELP}"
exit 0
;;
\? ) echo "${HELP}"
;;
\?)
echo "${HELP}"
exit 2
;;
esac
;;
esac
done

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
SCRIPTPATH="$(
cd "$(dirname "$0")"
pwd -P
)"

OS=$("$SCRIPTPATH"/ostype.sh)

function install_or_upgrade {
if ${FORCE} ; then
if ${FORCE}; then
BREW_FORCE="-f"
fi
if brew ls --versions "$1" >/dev/null; then
Expand All @@ -43,38 +49,44 @@ function install_or_upgrade {
function install_windows_shellcheck() {
version="v0.7.1"
if ! wget https://github.com/koalaman/shellcheck/releases/download/$version/shellcheck-$version.zip -O /tmp/shellcheck-$version.zip; then
rm /tmp/shellcheck-$version.zip &> /dev/null
rm /tmp/shellcheck-$version.zip &>/dev/null
echo "Error downloading shellcheck $version"
return 1
fi

if ! unzip -o /tmp/shellcheck-$version.zip shellcheck-$version.exe -d /tmp; then
rm /tmp/shellcheck-$version.zip &> /dev/null
rm /tmp/shellcheck-$version.zip &>/dev/null
echo "Unable to decompress shellcheck $version"
return 1
fi

if ! mv -f /tmp/shellcheck-$version.exe /usr/bin/shellcheck.exe; then
rm /tmp/shellcheck-$version.zip &> /dev/null
rm /tmp/shellcheck-$version.zip &>/dev/null
echo "Unable to move shellcheck to /usr/bin"
return 1
fi

rm /tmp/shellcheck-$version.zip &> /dev/null
rm /tmp/shellcheck-$version.zip &>/dev/null

return 0
}

if [ "${OS}" = "linux" ]; then
if ! which sudo > /dev/null; then
if ! which sudo >/dev/null; then
"$SCRIPTPATH/install_linux_deps.sh"
else
sudo "$SCRIPTPATH/install_linux_deps.sh"
fi
elif [ "${OS}" = "darwin" ]; then
if [ "${CIRCLECI}" != "true" ]; then
brew update
brew tap homebrew/cask
brew_version=$(brew --version | head -1 | cut -d' ' -f2)
major_version=$(echo $brew_version | cut -d. -f1)
minor_version=$(echo $brew_version | cut -d. -f2)
version_decimal="$major_version.$minor_version"
if (($(echo "$version_decimal < 2.5" | bc -l))); then
brew tap homebrew/cask
fi
fi
install_or_upgrade pkg-config
install_or_upgrade libtool
Expand Down