Skip to content

Commit

Permalink
Update dotfiles to include hash check for brew
Browse files Browse the repository at this point in the history
Removed previously as assumed association with the Brewfile dependency,
but its just a check for the hash of a previously installed brew
forumlae.

Issue: #12
  • Loading branch information
Newton committed Jul 24, 2014
1 parent 81e9c63 commit d022ef8
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions bin/dotfiles
Original file line number Diff line number Diff line change
Expand Up @@ -89,33 +89,31 @@ if type -P 'brew' &> /dev/null; then
# Upgrade Homebrew formulaes
brew upgrade

# Linking applications to ~/Applications
brew linkapps --local

# Install Homebrew formulae
# here check the hash as well
brews="${DIR}/opt/homebrew"

# update and upgrade all packages
brew update
brew upgrade
old_brew="$(cat '${DIR}/var/homebrew')"
new_brew="$(md5 "${brews}" | cut -d ' ' -f 4)"
if [[ $new_brew != $old_brew ]]; then

# store IFS within a temp variable
OIFS=$IFS
# store IFS within a temp variable
OIFS=$IFS

# set the separator to a carriage return & a new line break
# read in passed-in file and store as an array
IFS=$'\r\n' formulae=($(cat "${brews}"))
# set the separator to a carriage return & a new line break
# read in passed-in file and store as an array
IFS=$'\r\n' formulae=($(cat "${brews}"))

for index in ${!formulae[*]}
do
# Test whether a Homebrew formula is already installed
if ! brew list '${formulae[$index]}' &> /dev/null; then
brew install '${formulae[$index]}'
fi
done
for index in ${!formulae[*]}
do
# Test whether a Homebrew formula is already installed
if ! brew list '${formulae[$index]}' &> /dev/null; then
brew install '${formulae[$index]}'
fi
done

IFS=$OIFS
IFS=$OIFS
fi

brew cleanup

Expand Down

0 comments on commit d022ef8

Please sign in to comment.