scripts/install_pulp_consumer.sh

195 lines
8.9 KiB
Bash
Executable File

#!/bin/bash
LOG=/tmp/pulp_consumer_install.log
PYTHON_RHSM_URL=http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-1.15.4-5.el7.x86_64.rpm
ERROR_MSG="Check $LOG log"
. /etc/os-release
export LOG
export ERROR_MSG
function debug {
if [ -n "$DEBUG" ]; then
echo "DEBUG: $1"
fi
}
function run_cmd {
debug "Executing: $1..."
$1 >> $LOG 2>&1
if [ $? != 0 ]; then
echo "Error: Failed running command '$1'. $ERROR_MSG"
exit 1;
fi
}
echo ""
echo "This script will now install pulp_consumer"
echo ""
export TMPDIR=`mktemp -d /tmp/pulp_consumer.XXXXXX`
echo -e "Creating temp directory $TMPDIR...\n"
OSVER=$(echo $VERSION | awk '{print int($1+0.5)}') # Bash can only compare whole numbers
if [ $ID = 'ol' ] && [ $OSVER -ge 7 ]; then
echo "Note: python-rhsm has been remove from Oracle Linux 7. Pulling"
echo " python-rhsm from mirror.centos.org"
echo "Installing $PYTHON_RHSM_URL now..."
run_cmd "yum install -y $PYTHON_RHSM_URL"
fi
echo "Retrieving pulp repo..."
run_cmd "wget https://repos.fedorapeople.org/repos/pulp/pulp/rhel-pulp.repo -O /etc/yum.repos.d/rhel-pulp.repo"
echo "Installing pulp_consumer and its dependencies..."
run_cmd 'yum groupinstall -y pulp-consumer-qpid'
echo "Installing ssl packages for pulp_consumer message query (qpid)..."
run_cmd 'yum install -y qpid-cpp-server-ssl'
echo ""
echo "Extracting embedded files..."
echo ""
cat > $TMPDIR/archive.enc <<'_ENC'
H4sIAGy7J1cAA+06a4+jSJLzGan/A9JKN7PyTBkwfrWuT+JpYxtsDPi1arV4g8GA
eRjwr79MsKtc1T0zq5Vm905yqLvLzoyMiIx3ZJcZR1lxstMXM46cn/4awAAMSBL+
xId97PEn/Ijjg/5PODHEcZIgsSHAw/uDIfYTiv1F8ryDIsv1FEV/Covc9OoXL051
0/4B3p/t/z+Fv6GqZ6OZ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dbsxjMWKJgdFK8XNxsaZzmm7rHzzozfsLPR6C9iwhHLDhO4HYI
FRzXbDg70Ecjtxerk6JF426Zn9IwC6iVp9RkZYx6Kq1z3YV5zaZe5pKJtDyZ8pfn
xP+EJzzhCU94whOe8IQnPOEJT3jCE57whCc84QlPeMITnvCEJzzhCU94whOe8IQn
/B+D/wUWlo//AFAAAA==
_ENC
debug "Creating $TMPDIR/files..."
mkdir $TMPDIR/files
debug "Extracting archive to $TMPDIR/files..."
cat $TMPDIR/archive.enc | openssl base64 -d | tar xz -C $TMPDIR/files
echo "Done"
ca_file=$TMPDIR/files/ca.crt
cl_file=$TMPDIR/files/client.crt
cf_file=$TMPDIR/files/consumer.conf
dest=/etc/pki/pulp/qpid
debug "Creating $dest..."
run_cmd "mkdir $dest"
echo "Copying $ca_file to $dest..."
run_cmd "cp $ca_file $dest"
echo "Copying $cl_file to $dest..."
run_cmd "cp $cl_file $dest"
conf_dest=/etc/pulp/consumer
echo "Copying $cf_file to $conf_dest..."
run_cmd "mv $conf_dest/consumer.conf $conf_dest/consumer.conf.orig"
run_cmd "cp $cf_file $conf_dest"
echo "Enabling systemd pulp-agent service..."
run_cmd "systemctl enable goferd"
run_cmd "systemctl start goferd"
debug "Cleaning up..."
run_cmd "rm -fR $TMPDIR"