Created
November 29, 2017 17:49
-
-
Save ronlipke/b7426423e55937f9489ced87e3709bce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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