diff options
Diffstat (limited to 'omnibus/package-scripts/chef/preinst')
-rwxr-xr-x | omnibus/package-scripts/chef/preinst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/omnibus/package-scripts/chef/preinst b/omnibus/package-scripts/chef/preinst index 0baebe07f4..b3f48258c7 100755 --- a/omnibus/package-scripts/chef/preinst +++ b/omnibus/package-scripts/chef/preinst @@ -10,8 +10,12 @@ INSTALLER_DIR=/opt/chef echo "removing $INSTALLER_DIR..." -# we have to move the dir before trying to wipe it and then ignore errors since -# files may still be in use. +# have to do this dance of moving /opt/chef to a tmp dir since files may be in use tmp_dir="/opt/.chef.$$" +# if we can't create the tmp_dir then fail hard to prevent any possible security hole +(umask 077 && mkdir $tmp_dir) || exit 1 +# now we can clean up the tmp_dir we created safely mv $INSTALLER_DIR $tmp_dir +# ignore errors which must be EBUSY issues, this may crate some litter, which may +# be unavoidable rm -rf $tmp_dir || true |