I have created a script for deployment. During the pre
script, is it possible to know whats the version of the rpm I am deploying.
I want to create a backup file with the version of the RPM (in its name) so that i can trace back the version of the RPM file.
You could define some variables at the top of your spec file, and then use them in both the tags section and the pre script.
%define version <your-version>
%define relver <your-relver>
Version: %{version}
Release: %{relver}
%pre
/bin/cp your-file your-file.%{version}-%{relver}
You can verify the script will do the expected copy by querying the scripts in the RPM:
rpm -qp --scripts <path-to-your-rpm>/<your-rpm-name>.rpm