Compare installed RPM versions using Bash script
Hello All,
I am a newbie to the UNIX/Linux flavors and I am attempting to create an installer using RPM. Within my script I want to make sure that the systems has an installed vesion of RPM that is equal to or greater than a specified version. The below snippet gets the current version of RPM, but I am not sure how to parse the values to check for correctness.
#===========BEGIN Code snippet ==========
#============================================
f_Check_RPM_Version() # Checks the installed version of RPM
#============================================
{
ROOT_BIN_RPM="/bin/rpm"
USR_BIN_RPM="/usr/bin/rpm"
USR_LOCAL_BIN_RPM="/usr/local/bin/rpm"
#Checks to see if the RPM application
#is installed on the system
if [[ -e $ROOT_BIN_RPM || -e $USR_BIN_RPM|| -e $USR_LOCAL_BIN_RPM ]]; then
RPM_VERSION=`rpm -q rpm`
#****NEED to compare versions here *****
STR_BASE_ACCEPTABLE_VER="rpm-4.2-0.69"
#****NEED to compare versions here *****
printf "$STR_RPM_CORRECT_VERSION $RPM_VERSION"
else
printf "$STR_RPM_INCORRECT_VERSION"
exit 1
fi
} # end f_Check_RPM_Version()
#===========END Code snippet ==========
Any help you can proved would be greatly appreciated.
Best Regards,
-Jim
|