arttuladhar
3/1/2016 - 5:55 AM

uninstall_chefdk.sh

#!/bin/sh

echo "Run with sudo. This will completely uninstall ChefDK, continue? (y/n) "
read yn
if [ "$yn" != "y" ] && [ "$yn" != "Y" ]; then
  echo "Not doing anything. Exiting."
  exit 1
fi

echo "doing the stuff!"

if [ -d /opt/chefdk ]; then
  rm -rf /opt/chefdk
else
  echo "/opt/chefdk doesn't exist"
fi

pkgutil --forget com.getchef.pkg.chefdk

find /usr/bin -lname '/opt/chefdk/*' -delete

if [ -d ~/.chefdk ]; then
  echo "Moving ~/.chefdk to ~/.chefdk_old"
  mv ~/.chefdk ~/.chefdk_old
fi

echo "Done! Now you can reinstall ChefDK: https://docs.chef.io/install_dk.html"