Skip to content

Instantly share code, notes, and snippets.

@mva-verbit
Created December 2, 2021 15:22
Show Gist options
  • Save mva-verbit/dc1a4251dc8d3866d41a2ec11c66060c to your computer and use it in GitHub Desktop.
Save mva-verbit/dc1a4251dc8d3866d41a2ec11c66060c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
STATUS=0
BREW_STATUS=0
AWS_STATUS=0
SSM_STATUS=0
DBEAVER_STATUS=0
AWS_CLI_URL="https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac/session-manager-plugin.pkg"
echo "Tools installation started"
echo "=========================="
echo "Running install of brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ "$?" -eq 0 ]; then echo "Finished isntalling brew.."; else AWS_STATUS=1 && echo "Failed to install brew";fi
echo "Running install of aws-cli..."
brew install awscli
if [ "$?" -eq 0 ]; then echo "Finished isntalling aws-cli..."; else AWS_STATUS=1 && echo "Failed to install awscli";fi
echo "Running install of ssm-plugin..."
curl $AWS_CLI_URL -o "session-manager-plugin.pkg"
sudo installer -pkg session-manager-plugin.pkg -target /
if [ "$?" -eq 0 ]; then
sudo ln -s /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/bin/session-manager-plugin
echo "Finished installing ssm-plugin...";
else
SSM_STATUS=1
echo "Failed to install ssm-plugin";
fi
echo "Running install for dbeaver"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null
brew install --cask dbeaver-community
if [ "$?" -eq 0 ]; then echo "Finished isntalling dbeaver..."; else DBEAVER_STATUS=1 && echo "Failed to install dbeaver";fi
echo "==========================="
if [ "$BREW_STATUS" -ne 0 ] || [ "$AWS_STATUS" -ne 0 ] || [ "$SSM_STATUS" -ne 0 ] || [ "$DBEAVER_STATUS" -ne 0 ]; then STATUS=1;fi
if [ "$STATUS" -eq 0 ]; then
echo "Tools installation finished successfully"
else
echo "Tools installation finished with errors:"
if [ "$BREW_STATUS" -ne 0 ]; then echo "BREW STATUS: FAILED"; fi
if [ "$AWS_STATUS" -ne 0 ]; then echo "AWS STATUS: FAILED"; fi
if [ "$SSM_STATUS" -ne 0 ]; then echo "SSM STATUS: FAILED"; fi
if [ "$DBEAVER_STATUS" -ne 0 ]; then echo "DBEAVER STATUS: FAILED"; fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment