Skip to content

Instantly share code, notes, and snippets.

@dserodio
Created February 4, 2015 13:00
Show Gist options
  • Save dserodio/ee77f93d6ad909e94002 to your computer and use it in GitHub Desktop.
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
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