#!/bin/bash
USER_NAME=$1
PASSWORD=$2
RPM_NAME=$3
if [ -z $USER_NAME -o -z $PASSWORD -o -z $RPM_NAME ]
then
echo "Empty user name or password or rpm name , usage is ./openssl-update.sh username password rpmname "
exit 0;
fi
date_time=$(date +'%F-%T')
export INST_LOG_DIR="/tmp/novell_access_manager"
export OPENSSL_UPGRADE_LOG="${INST_LOG_DIR}/upgrade_openssl_${date_time}.log"
if [ ! -d /opt/novell/nam/mag ]
then
echo "The rpm $RPM_NAME is not applicable on this system."
exit 0;
fi
if rpm -q $RPM_NAME > /dev/null
then
echo "The rpm $RPM_NAME is already installed, nothing to upgrade."
exit 0;
fi
echo "Downloading the rpm $RPM_NAME ......"
wget -q --no-check-certificate --http-user=$USER_NAME --http-password=$PASSWORD 'https://nu.novell.com/repo/%24RCE/AM-AG-Appliance-4.5.2-Product/sle-12-x86_64/rpm/x86_64/'$RPM_NAME.x86_64.rpm > $OPENSSL_UPGRADE_LOG 2>&1
if [ ! -L "/usr/bin/sh" ]
then
ln -s /bin/bash /usr/bin/sh
fi
rpm -Uvh $RPM_NAME.x86_64.rpm >> $OPENSSL_UPGRADE_LOG 2>&1
if [ "$?" == 0 ]
then
echo "Upgraded $RPM_NAME."
else
echo "Upgrade of $RPM_NAME failed."
fi
rm -rf $RPM_NAME*
