Tuesday, 15 January 2013

rpmbuild - how to make an update rpm which dose nothing but run a shell command? -


itemprop = "text">

I create an RPM called rsv-1.0, when you rsv-1.0.rpm

package Only one file, etc. / rsc.cfg

What if I want to make a change in file rsv.cfg for an updated RPM rsv-2.0 .rpm

then I made a blank diary and tire it RSV-2.0 tar.gz, where it was included in the new SPEC file

 % post if [-f / etc] /rsv.cfg ]; So / bin / echo "hello-2.0" & gt; /etc/rsv.cfg fi   

as a shell command

but I think it only works when you rpm -ivh rsv-2.0 .rpm

If you use rpm -Uv rsv-2.0.rpm, then the file disappears in /etc/rsv.cfg

then my The question is, how to make an updated RPM that does not lose anything but the command to run the shell?

Update file for v2

  Name: RSV Version: 2.0 Release: 1 Summary: RSV RPM Group: RSV License: GPL + URL: Source 0:% {Name} -% {version} .tar.gz BuildRoot:% {_ tmppath} /% {name} -% {version} -% {release} -Rup #BldRiverware: # Requirement:% Details% {Summary}% PRP% Setup - Q % Build% install rm -rf% {buildroot} mkdir -p% {buildroot} #cp -a *% {buildroot}% clean rm-rf% {buildroot}% post if [-f /etc/rsv.cfg]; So / bin / echo "hello-2.0" & gt; /etc/rsv.cfg fi% files% defattr (-, root, root, -)% doc #% config% {_ sysconfdir} /% {name}. Cfg% changelog   

The spec file for v1.0 is just% cconf and #cp

Because the original spec file was incorrect and clearly did not list the file as a configuration file, I thinks is the same It's erasing.

See a potential improvement version 2 % pre section for whether it exists and copy it somewhere.

This may be misleading, a second copy has been established, by their name as % pre /% post , and then the first copy % preun /% postun .

No comments:

Post a Comment