Skip to content

Commit

Permalink
Merge pull request #35 from ferricoxide/Issue_33
Browse files Browse the repository at this point in the history
Rolls Back Changes from PR #32 That Break CS and OEL 9
  • Loading branch information
ferricoxide authored Oct 23, 2024
2 parents 0568609 + 9e7c38d commit 070c713
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions AWSutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,75 +354,12 @@ function InstallCfnBootstrap {
chroot "${CHROOTMNT}" alternatives --verbose --install /opt/aws/bin/cfn-hup cfn-hup /usr/local/bin/cfn-hup 1 || \
err_exit "Failed configuring cfn-hup symlink"

# Install systemd-supporting content
InstallCfnBootstrap_systemd

err_exit "Cleaning up install files..." NONE
rm -rf "${CHROOTMNT}${TMPDIR}" || \
err_exit "Failed cleaning up install files"
fi
}

# Install systemd bits
function InstallCfnBootstrap_systemd {
local SVC_NAME="cfn-hup"
local ETC_DIR="${CHROOTMNT}/etc/systemd/system"
local SVC_FILE="${ETC_DIR}/${SVC_NAME}.service"
local OS_VERSION

SVC_NAME="cfn-hup"
ETC_DIR="${CHROOTMNT}/etc/systemd/system"
SVC_FILE="${ETC_DIR}/${SVC_NAME}.service"
OS_VERSION="$(
awk -F "=" '/^VERSION=/{ print $2 }' /etc/os-release | \
sed -e 's/"//g' | \
cut -d '.' -f 1
)"

if [[ ${OS_VERSION} -ge 9 ]]
then
err_exit "EL 9+ distros want systemd units..." NONE

if [[ ! -d ${ETC_DIR} ]]
then
err_exit "Creating ${ETC_DIR}" NONE
install -dDm 0755 "${ETC_DIR}" || \
err_exit "Failed creating ${ETC_DIR}"
fi

if [[ ! -f ${SVC_FILE} ]]
then
err_exit "Installing systemd unit-file for ${SVC_NAME}..." NONE
install -bDm 0644 <(
echo "[Unit]"
echo "Description=cfn-hup Service"
echo "After=network.target"
echo ""
echo "[Service]"
echo "ExecStart=/usr/local/bin/cfn-hup"
echo "Type=forking"
echo "PIDFile=/run/cfn-hup.pid"
echo ""
echo "[Install]"
echo "WantedBy=multi-user.target"
) "${SVC_FILE}" || \
err_exit "Failed installing systemd unit-file for ${SVC_NAME}"
fi

if [[ ! -d ${CHROOTMNT}/etc/cfn ]]
then
err_exit "Creating /etc/cfn directory" NONE
install -Z "system_u:object_r:etc_t:s0" -dDm 0755 -o root \
-g root /etc/cfn || err_exit "Failed creating /etc/cfn directory" NONE
fi

chroot "${CHROOTMNT}" /usr/bin/systemctl disable "${SVC_NAME}.service" || \
err_exit "FAILED"
fi

return
}

# shellcheck disable=SC2016,SC1003
function ProfileSetupAwsCli {
install -bDm 0644 -o root -g root <(
Expand Down

0 comments on commit 070c713

Please sign in to comment.