Skip to content

Instantly share code, notes, and snippets.

@ronlipke
Created November 29, 2017 17:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronlipke/b7426423e55937f9489ced87e3709bce to your computer and use it in GitHub Desktop.
Save ronlipke/b7426423e55937f9489ced87e3709bce to your computer and use it in GitHub Desktop.
#!/bin/bash
# Assumes you already have the dmg downloaded in ~/Downloads
case "$1" in
old)
echo "Installing 0.15.16-1"
CHEFDK_VERSION="0.15.16-1"
;;
new)
echo "Installing 2.4.15-1"
CHEFDK_VERSION="2.4.15-1"
;;
*)
echo "use old for 0.15.16 or new for 2.4.15-1"
exit 1
esac
# Get sudo
echo "-------- Need sudo to continue --------"
sudo true || { echo; echo "-- You might want to reset your password --"; exit 1; }
echo "-- got it --"
sudo rm -rf /opt/chefdk
sudo pkgutil --forget com.getchef.pkg.chefdk
ls -la /usr/local/bin | egrep '/opt/chefdk' | awk '{ print $9 }' | sudo xargs -I % rm -f /usr/local/bin/%
sudo rm -rf ~/.gem
sudo rm -rf ~/.berkshelf
sudo rm -rf ~/.chefdk
sudo hdiutil attach /Users/$(logname)/Downloads/chefdk-$CHEFDK_VERSION.dmg
sudo installer -package /Volumes/"Chef Development Kit"/chefdk-$CHEFDK_VERSION.pkg -target /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment