Last active
April 8, 2017 07:22
-
-
Save uesteibar/834f8eddb2ff978de4e5e69898301563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
talk() { | |
echo -e $1 | |
} | |
hr() { | |
echo -e "\n" | |
} | |
confirm() { | |
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n' | |
} | |
debug() { | |
if [ -n "$DEBUG" ] | |
then | |
echo -e "[DEBUG] $1" | |
fi | |
} | |
clear | |
debug "Debug mode on" | |
cat << "EOF" | |
/$$$$$$ /$$ /$$ /$$ | |
/$$__ $$| $$ | $$ | $$ | |
| $$ \__/| $$ /$$$$$$ /$$$$$$ | $$$$$$$$ | |
| $$$$$$ | $$ /$$__ $$|_ $$_/ | $$__ $$ | |
\____ $$| $$| $$ \ $$ | $$ | $$ \ $$ | |
/$$ \ $$| $$| $$ | $$ | $$ /$$| $$ | $$ | |
| $$$$$$/| $$| $$$$$$/ | $$$$/| $$ | $$ | |
\______/ |__/ \______/ \___/ |__/ |__/ | |
EOF | |
talk "In order to install software for you, we need administrator permissions\n" | |
debug "Caching sudo" | |
sudo ls /tmp > /dev/null | |
hr | |
debug "Installing brew" | |
brew --version > /dev/null | |
if [ $? -ne 0 ] | |
then | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null | |
fi | |
debug "Installing ansible" | |
brew install ansible | |
clear | |
debug "Installing selected packages" | |
ansible-playbook -i ~/.sloth/sloth_inventory ~/.sloth/sloth_install.yml | |
rm -rf ~/.sloth | |
if [ $? -eq 0 ] | |
then | |
clear | |
hr | |
talk "(^_^) We're done here. Please check everything is in place." | |
else | |
clear | |
hr | |
talk "Something went wrong, please try again." | |
fi | |
hr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment