Skip to content

Instantly share code, notes, and snippets.

@stahnma
Last active March 17, 2016 22:02
Show Gist options
  • Save stahnma/daaa9dc364bff5178cd7 to your computer and use it in GitHub Desktop.
Save stahnma/daaa9dc364bff5178cd7 to your computer and use it in GitHub Desktop.
#!/bin/bash
export PATH=$PATH:/usr/local/bin
[ $# -eq 0 ] && { echo "Usage: $0 pkg"; exit 1; }
osx_ver=$(sw_vers -productVersion | cut -f1,2 -d.)
url=http://pl-build-tools.delivery.puppetlabs.net/osx/$osx_ver
for pkg in "$@"; do
if [[ $pkg =~ ^(pl|apple)-.* ]]; then
echo "Using DMG..."
dmgpkg=$pkg-osx-$osx_ver-x86_64.dmg
curl "$url/$dmgpkg" -o "$dmgpkg"
tmpmount=`/usr/bin/mktemp -d /tmp/pl-build-tools.XXXX`
hdiutil attach "$dmgpkg" -mountpoint "$tmpmount" -nobrowse -quiet
installer -pkg "$(find $tmpmount -name '*.pkg')" -target /
hdiutil detach "$tmpmount" -quiet
rm -rf "$tmpmount"
rm "$dmgpkg"
else
echo "Using brew..."
export HOMEBREW_BOTTLE_DOMAIN=http://pl-build-tools.delivery.puppetlabs.net/osx
brew install puppetlabs/brew-build-tools/$pkg
fi
done
echo "Finished installing build deps..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment