summaryrefslogtreecommitdiff
path: root/omnibus
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-12-13 13:30:14 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2018-12-13 13:30:14 -0800
commit190e39fcb17240b8ac07d7c5784d77417137e206 (patch)
tree3d86b89f9485f2ad3ae84e3c2fa28c049fcdc016 /omnibus
parent87e0d8ae8babd9c38b5b3c440cb774fd3b558e38 (diff)
downloadchef-190e39fcb17240b8ac07d7c5784d77417137e206.tar.gz
fix EBUSY errors in preinst script
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'omnibus')
-rwxr-xr-xomnibus/package-scripts/angrychef/preinst9
-rwxr-xr-xomnibus/package-scripts/chef-fips/preinst9
-rwxr-xr-xomnibus/package-scripts/chef/preinst7
3 files changed, 20 insertions, 5 deletions
diff --git a/omnibus/package-scripts/angrychef/preinst b/omnibus/package-scripts/angrychef/preinst
index b3038a10c6..0baebe07f4 100755
--- a/omnibus/package-scripts/angrychef/preinst
+++ b/omnibus/package-scripts/angrychef/preinst
@@ -7,6 +7,11 @@
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
-INSTALLER_DIR=/opt/angrychef
+INSTALLER_DIR=/opt/chef
echo "removing $INSTALLER_DIR..."
-rm -rf $INSTALLER_DIR
+
+# we have to move the dir before trying to wipe it and then ignore errors since
+# files may still be in use.
+tmp_dir="/opt/.chef.$$"
+mv $INSTALLER_DIR $tmp_dir
+rm -rf $tmp_dir || true
diff --git a/omnibus/package-scripts/chef-fips/preinst b/omnibus/package-scripts/chef-fips/preinst
index 834c29544b..0baebe07f4 100755
--- a/omnibus/package-scripts/chef-fips/preinst
+++ b/omnibus/package-scripts/chef-fips/preinst
@@ -7,6 +7,11 @@
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
-INSTALLER_DIR=/opt/chef-fips
+INSTALLER_DIR=/opt/chef
echo "removing $INSTALLER_DIR..."
-rm -rf $INSTALLER_DIR
+
+# we have to move the dir before trying to wipe it and then ignore errors since
+# files may still be in use.
+tmp_dir="/opt/.chef.$$"
+mv $INSTALLER_DIR $tmp_dir
+rm -rf $tmp_dir || true
diff --git a/omnibus/package-scripts/chef/preinst b/omnibus/package-scripts/chef/preinst
index 1880275e99..0baebe07f4 100755
--- a/omnibus/package-scripts/chef/preinst
+++ b/omnibus/package-scripts/chef/preinst
@@ -9,4 +9,9 @@
INSTALLER_DIR=/opt/chef
echo "removing $INSTALLER_DIR..."
-rm -rf $INSTALLER_DIR
+
+# we have to move the dir before trying to wipe it and then ignore errors since
+# files may still be in use.
+tmp_dir="/opt/.chef.$$"
+mv $INSTALLER_DIR $tmp_dir
+rm -rf $tmp_dir || true