summaryrefslogtreecommitdiff
path: root/omnibus/package-scripts
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-05-08 10:02:01 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-05-08 10:02:01 -0700
commitd5e12e6d2f971ef70e9d6d29331123e2701b796c (patch)
treeb99c420e72670e7896c226d3909d7b48cd9350da /omnibus/package-scripts
parent49bf045c8b7f223e5cf324847889222f8ee6145a (diff)
downloadchef-d5e12e6d2f971ef70e9d6d29331123e2701b796c.tar.gz
clean up omnibus installer error and remove chef-fips
clean up the warning in #8484 also removes the chef-fips package-scripts directory which we don't use because the purpose-built fips build went away a long time ago (but nobody cleaned up the cruft). closes #8484 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'omnibus/package-scripts')
-rwxr-xr-xomnibus/package-scripts/angrychef/preinst24
-rwxr-xr-xomnibus/package-scripts/chef-fips/postinst111
-rwxr-xr-xomnibus/package-scripts/chef-fips/postrm50
-rwxr-xr-xomnibus/package-scripts/chef-fips/preinst21
-rwxr-xr-xomnibus/package-scripts/chef/preinst22
5 files changed, 25 insertions, 203 deletions
diff --git a/omnibus/package-scripts/angrychef/preinst b/omnibus/package-scripts/angrychef/preinst
index 870bd5fc37..e38c3f7a3e 100755
--- a/omnibus/package-scripts/angrychef/preinst
+++ b/omnibus/package-scripts/angrychef/preinst
@@ -7,15 +7,17 @@
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
-INSTALLER_DIR=/opt/angrychef
-echo "removing $INSTALLER_DIR..."
+INSTALLER_DIR=/opt/chef
+if [ -e $INSTALLER_DIR ]; then
+ 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
+ # 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
+fi
diff --git a/omnibus/package-scripts/chef-fips/postinst b/omnibus/package-scripts/chef-fips/postinst
deleted file mode 100755
index d693f65193..0000000000
--- a/omnibus/package-scripts/chef-fips/postinst
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/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.
-#
-# Install a full Opscode Client
-#
-
-PROGNAME=`basename $0`
-INSTALLER_DIR=/opt/chef-fips
-CONFIG_DIR=/etc/chef
-USAGE="usage: $0 [-v validation_key] ([-o organization] || [-u url])"
-
-error_exit()
-{
- echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
- exit 1
-}
-
-is_darwin()
-{
- uname -v | grep "^Darwin" 2>&1 >/dev/null
-}
-
-is_smartos()
-{
- uname -v | grep "^joyent" 2>&1 >/dev/null
-}
-
-if is_smartos; then
- PREFIX="/opt/local"
-elif is_darwin; then
- PREFIX="/usr/local"
- mkdir -p "$PREFIX/bin"
-else
- PREFIX="/usr"
-fi
-
-validation_key=
-organization=
-chef_url=
-
-while getopts o:u:v: opt
-do
- case "$opt" in
- v) validation_key="${OPTARG}";;
- o) organization="${OPTARG}"; chef_url="https://api.opscode.com/organizations/${OPTARG}";;
- u) chef_url="${OPTARG}";;
- \?) # unknown flag
- echo >&2 ${USAGE}
- exit 1;;
- esac
-done
-shift `expr ${OPTIND} - 1`
-
-if [ "" != "$chef_url" ]; then
- mkdir -p ${CONFIG_DIR} || error_exit "Cannot create ${CONFIG_DIR}!"
- (
- cat <<'EOP'
-log_level :info
-log_location STDOUT
-EOP
- ) > ${CONFIG_DIR}/client.rb
- if [ "" != "$chef_url" ]; then
- echo "chef_server_url '${chef_url}'" >> ${CONFIG_DIR}/client.rb
- fi
- if [ "" != "$organization" ]; then
- echo "validation_client_name '${organization}-validator'" >> ${CONFIG_DIR}/client.rb
- fi
- chmod 644 ${CONFIG_DIR}/client.rb
-fi
-
-if [ "" != "$validation_key" ]; then
- cp ${validation_key} ${CONFIG_DIR}/validation.pem || error_exit "Cannot copy the validation key!"
- chmod 600 ${CONFIG_DIR}/validation.pem
-fi
-
-# rm -f before ln -sf is required for solaris 9
-rm -f $PREFIX/bin/chef-client
-rm -f $PREFIX/bin/chef-solo
-rm -f $PREFIX/bin/chef-apply
-rm -f $PREFIX/bin/chef-shell
-rm -f $PREFIX/bin/knife
-rm -f $PREFIX/bin/ohai
-
-ln -sf $INSTALLER_DIR/bin/chef-solo $PREFIX/bin || error_exit "Cannot link chef-solo to $PREFIX/bin"
-if [ -f "$INSTALLER_DIR/bin/chef-apply" ]; then
- ln -sf $INSTALLER_DIR/bin/chef-apply $PREFIX/bin || error_exit "Cannot link chef-apply to $PREFIX/bin"
-fi
-if [ -f "$INSTALLER_DIR/bin/chef-shell" ]; then
- ln -sf $INSTALLER_DIR/bin/chef-shell $PREFIX/bin || error_exit "Cannot link chef-shell to $PREFIX/bin"
-fi
-ln -sf $INSTALLER_DIR/bin/knife $PREFIX/bin || error_exit "Cannot link knife to $PREFIX/bin"
-ln -sf $INSTALLER_DIR/bin/ohai $PREFIX/bin || error_exit "Cannot link ohai to $PREFIX/bin"
-
-# We test for the presence of /usr/bin/chef-client to know if this script succeeds, so this
-# must appear as the last real action in the script
-ln -sf $INSTALLER_DIR/bin/chef-client $PREFIX/bin || error_exit "Cannot link chef-client to $PREFIX/bin"
-
-# Ensure all files/directories in $INSTALLER_DIR are owned by root. This
-# has been fixed on new installs but upgrades from old installs need to
-# be manually fixed.
-chown -Rh 0:0 $INSTALLER_DIR
-
-echo "Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io"
-
-exit 0
diff --git a/omnibus/package-scripts/chef-fips/postrm b/omnibus/package-scripts/chef-fips/postrm
deleted file mode 100755
index a153da7102..0000000000
--- a/omnibus/package-scripts/chef-fips/postrm
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/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
-}
-
-is_suse() {
- if [ -f /etc/os-release ]; then
- . /etc/os-release
- [ "$ID_LIKE" = "sles" ] || [ "$ID_LIKE" = "suse" ]
- else
- [ -f /etc/SuSE-release ]
- fi
-}
-
-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 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 ! is_suse ]; 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
diff --git a/omnibus/package-scripts/chef-fips/preinst b/omnibus/package-scripts/chef-fips/preinst
deleted file mode 100755
index 69909262c9..0000000000
--- a/omnibus/package-scripts/chef-fips/preinst
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/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
diff --git a/omnibus/package-scripts/chef/preinst b/omnibus/package-scripts/chef/preinst
index b3f48258c7..e38c3f7a3e 100755
--- a/omnibus/package-scripts/chef/preinst
+++ b/omnibus/package-scripts/chef/preinst
@@ -8,14 +8,16 @@
# - if you are under 40, get peer review from your elders.
INSTALLER_DIR=/opt/chef
-echo "removing $INSTALLER_DIR..."
+if [ -e $INSTALLER_DIR ]; then
+ 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
+ # 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
+fi