-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds an uninstall program for macs. Signed-off-by: Jon Morrow <jmorrow@chef.io>
- Loading branch information
Jon Morrow
committed
Oct 11, 2018
1 parent
a007a4b
commit 6d7e053
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name "uninstall-scripts" | ||
|
||
source path: "#{project.files_path}/uninstall-scripts" | ||
|
||
skip_transitive_dependency_licensing true | ||
license :project_license | ||
|
||
build do | ||
if mac_os_x? | ||
copy "#{project_dir}/uninstall.sh", "#{install_dir}/bin/uninstall_chef_workstation", { :preserve => true } | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
# | ||
# Perform necessary steps to unsinstall | ||
# Chef Workstation. | ||
# | ||
|
||
PROGNAME=`basename $0` | ||
|
||
error_exit() | ||
{ | ||
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2 | ||
exit 1 | ||
} | ||
|
||
is_darwin() | ||
{ | ||
uname -v | grep "^Darwin" 2>&1 >/dev/null | ||
} | ||
|
||
if is_darwin; then | ||
echo "This uninstaller will remove Chef Workstation" | ||
if ! sudo -n true 2>/dev/null; then | ||
echo "Enter your password to continue" | ||
fi | ||
sudo -s -- <<EOF | ||
echo "Uninstalling Chef Workstation" | ||
pkgId='com.getchef.pkg.chef-workstation' | ||
echo "Closing Chef Workstation App" | ||
osascript -e 'quit app "Chef Workstation App"' | ||
echo "Removing files" | ||
sudo rm -rf '/opt/chef-workstation' | ||
sudo rm -rf '/Applications/Chef Workstation App.app' | ||
echo "Removing binary links in /usr/local/bin" | ||
sudo find /usr/local/bin -lname '/opt/chef-workstation/*' -delete | ||
echo "Forgeting $pkgId" | ||
sudo pkgutil --forget $pkgId | ||
echo "Chef Workstation Uninstalled" | ||
EOF | ||
fi |
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