diff options
author | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2016-01-08 13:22:45 -0800 |
---|---|---|
committer | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2016-01-08 13:22:45 -0800 |
commit | 5a0031d962402221b580df270e8802b71d5ea1f0 (patch) | |
tree | c57c56e8115c04e14f40ecad2b83c2d8f0f99fcf /omnibus/package-scripts/chef/postrm | |
parent | c9d7e017de225db3e8b8610dc7e2f41242dbe730 (diff) | |
parent | 286c306edfb9c5b90a6c1f382defb9efd1580e96 (diff) | |
download | chef-5a0031d962402221b580df270e8802b71d5ea1f0.tar.gz |
Import all of omnibus-chef under the omnibus directory
Diffstat (limited to 'omnibus/package-scripts/chef/postrm')
-rwxr-xr-x | omnibus/package-scripts/chef/postrm | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/omnibus/package-scripts/chef/postrm b/omnibus/package-scripts/chef/postrm new file mode 100755 index 0000000000..724c082be7 --- /dev/null +++ b/omnibus/package-scripts/chef/postrm @@ -0,0 +1,42 @@ +#!/bin/sh +# WARNING: REQUIRES /bin/sh +# +# - must run on /bin/sh on solaris 9 +# - must run on /bin/sh on AIX 6.x +# - if you think you are a bash wizard, you probably do not understand +# this programming language. do not touch. +# - if you are under 40, get peer review from your elders. + +is_smartos() { + uname -v | grep "^joyent" 2>&1 >/dev/null +} + +is_darwin() +{ + uname -v | grep "^Darwin" 2>&1 >/dev/null +} + +if is_smartos; then + PREFIX="/opt/local" +elif is_darwin; then + PREFIX="/usr/local" +else + PREFIX="/usr" +fi + +cleanup_symlinks() { + binaries="chef-client chef-solo chef-apply chef-shell knife shef ohai" + for binary in $binaries; do + rm -f $PREFIX/bin/$binary + done +} + +# Clean up binary symlinks if they exist +# see: http://tickets.opscode.com/browse/CHEF-3022 +if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! -f /etc/SuSE-release ]; then + # not a redhat-ish RPM-based system + cleanup_symlinks +elif [ "x$1" = "x0" ]; then + # RPM-based system and we're deinstalling rather than upgrading + cleanup_symlinks +fi |