Created
February 4, 2015 13:00
-
-
Save dserodio/ee77f93d6ad909e94002 to your computer and use it in GitHub Desktop.
Upgrade Brew if on OS X or apt-get otherwise. If parameter is received, upgrade a remote (Ubuntu) machine
This file contains hidden or 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
if [ -z $1 ] | |
then | |
if [ "$OS" == "Darwin" ] | |
then | |
echo "Updating…" | |
brew update | |
echo "Upgrading…" | |
brew upgrade | |
else | |
sudo apt-get update | |
sudo apt-get -u upgrade | |
fi | |
else | |
ssh $1 -t sudo apt-get update | |
local dummy | |
ssh $1 -t sudo apt-get --no-act upgrade | |
echo -n "Process the upgrade ?" | |
read -q dummy | |
if [[ $dummy = "y" ]] | |
then | |
ssh $1 -t sudo apt-get -u upgrade --yes | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment