You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to backup some conf files of my package during upgrade into directory called e.g /mypackage-<old-version>.
So I'm trying to get old package version in %pre scriplet and doing it in the following way:
And the strange thing is that VERS variable got version of the package that I'm upgrading to (newer), while value of VERS_ALTERNATIVE contains version of the package that I'm upgrading from (older).
I'm do realize that invoking rpm -q in RPM scirplets is not the best idea, but anyway for me seems like this behavior is some kind of bug, as I suppose that in all cases result of rpm -qi and rpm --queryformat should output similar information.
I got this in CentOS 8 with RPM version 4.14.2. Same problem in CentOS 7.
The text was updated successfully, but these errors were encountered:
%{VERSION} is replaced within the spec file itself. You need to use %%{VERSION} to avoid expanding the macro right away.
As you already said this is probably a really bad idea anyway. RPM actually does backup modified config files on it's own if they are tagged as config files in the package. Do things like this in a %pre script should not be necessary for all but very exotic cases.
I need to backup some conf files of my package during upgrade into directory called e.g
/mypackage-<old-version>
.So I'm trying to get old package version in
%pre
scriplet and doing it in the following way:And the strange thing is that
VERS
variable got version of the package that I'm upgrading to (newer), while value ofVERS_ALTERNATIVE
contains version of the package that I'm upgrading from (older).I'm do realize that invoking
rpm -q
in RPM scirplets is not the best idea, but anyway for me seems like this behavior is some kind of bug, as I suppose that in all cases result ofrpm -qi
andrpm --queryformat
should output similar information.I got this in CentOS 8 with RPM version 4.14.2. Same problem in CentOS 7.
The text was updated successfully, but these errors were encountered: