I need to find the previous version of the package (if installed already) when installing rpm. My spec file as follows
In POST
%post
if [ "$1" = "1" ]; then
# Perform new install
fi
elif [ "$1" = "2" ]; then
# Perform update
# what I need is value for Version
if [ $Version = 1.0]; then
# do upgrade 1
fi
elif [ "$Version" = "2" ]; then
#do upgrade 2
fi
fi
In the above code, how can i obtain value for the Version. I tried using executing rpm-qi | grep <rpm_package>
is there any other methods available?