summaryrefslogtreecommitdiff
path: root/omnibus/package-scripts/chef-fips/preinst
blob: 69909262c93c03213e9c1f4bca137a564d9c498c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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.

INSTALLER_DIR=/opt/chef-fips
echo "removing $INSTALLER_DIR..."

# 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