i build a rpm called rsv-1.0, it will automatically install a rsv.cfg file to /etc when you install rsv-1.0.rpm
the package only contain one file etc/rsc.cfg
what if i want to do a change in the file rsv.cfg for a updated rpm say rsv-2.0.rpm
i then created a empty dir and tared it to rsv-2.0.tar.gz including this in new SPEC file
%post
if [ -f /etc/rsv.cfg ]; then
/bin/echo "hello-2.0" > /etc/rsv.cfg
fi
as a shell command
but i find it only works when you use rpm -ivh rsv-2.0.rpm
if you use rpm -Uvh rsv-2.0.rpm, the file in /etc/rsv.cfg disappear
so my question is, how to make an update rpm which dose nothing but run a shell command?
update spec file for v2
Name: rsv
Version: 2.0
Release: 1
Summary: rsv rpm
Group: rsv
License: GPL+
URL:
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
#BuildRequires:
#Requires:
%description
%{summary}
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
#cp -a * %{buildroot}
%clean
rm -rf %{buildroot}
%post
if [ -f /etc/rsv.cfg ]; then
/bin/echo "hello-2.0" > /etc/rsv.cfg
fi
%files
%defattr(-,root,root,-)
%doc
#%config %{_sysconfdir}/%{name}.cfg
%changelog
the spec file for v1.0 is just uncomment %config and #cp