Better update function

This commit is contained in:
Veit Heller
2014-06-30 14:29:04 +02:00
parent f9dcd11abc
commit b88376f929
2 changed files with 42 additions and 16 deletions

View File

@@ -65,12 +65,25 @@ pinfo(){
} }
update(){ update(){
echo "Updating homebrew formulae" yellow='\e[1;33m'
brew update > /dev/null none='\e[0m'
echo "Updating installed sources(Homebrew)" if $1 == '-v' ; then
echo -e "${yellow}Updating homebrew formulae${none}"
brew update
echo -e "${yellow}Updating installed sources(Homebrew)${none}"
brew upgrade outdated
echo -e "${yellow}Updating MacPorts (sudo required)${none}"
sudo port selfupdate
echo -e "${yellow}Updating installed sources(MacPorts)${none}"
sudo port upgrade outdated
else
echo -e "${yellow}Updating homebrew formulae${none}"
brew update &> /dev/null
echo -e "${yellow}Updating installed sources(Homebrew)${none}"
brew upgrade outdated &> /dev/null brew upgrade outdated &> /dev/null
echo "Updating MacPorts (sudo required)" echo -e "${yellow}Updating MacPorts (sudo required)${none}"
sudo port selfupdate > /dev/null sudo port selfupdate &> /dev/null
echo "Updating installed sources(MacPorts)" echo -e "${yellow}Updating installed sources(MacPorts)${none}"
sudo port upgrade outdated > /dev/null sudo port upgrade outdated & /dev/null
fi
} }

27
zshrc
View File

@@ -99,12 +99,25 @@ pinfo(){
} }
update(){ update(){
echo "Updating homebrew formulae" yellow='\e[1;33m'
brew update > /dev/null none='\e[0m'
echo "Updating installed sources(Homebrew)" if $1 == '-v' ; then
echo -e "${yellow}Updating homebrew formulae${none}"
brew update
echo -e "${yellow}Updating installed sources(Homebrew)${none}"
brew upgrade outdated
echo -e "${yellow}Updating MacPorts (sudo required)${none}"
sudo port selfupdate
echo -e "${yellow}Updating installed sources(MacPorts)${none}"
sudo port upgrade outdated
else
echo -e "${yellow}Updating homebrew formulae${none}"
brew update &> /dev/null
echo -e "${yellow}Updating installed sources(Homebrew)${none}"
brew upgrade outdated &> /dev/null brew upgrade outdated &> /dev/null
echo "Updating MacPorts (sudo required)" echo -e "${yellow}Updating MacPorts (sudo required)${none}"
sudo port selfupdate > /dev/null sudo port selfupdate &> /dev/null
echo "Updating installed sources(MacPorts)" echo -e "${yellow}Updating installed sources(MacPorts)${none}"
sudo port upgrade outdated > /dev/null sudo port upgrade outdated & /dev/null
fi
} }