[Fedora-packaging] how to check on upgrade rpm

Léon Keijser keijser at stone-it.com
Thu Dec 17 12:29:20 UTC 2009


I'm making a package of a webapp that consists mainly of php and image
files. When installing the package for the first time, an '/install'
directory is copied. The user accesses the webapp for the first time,
configures it and has to remove the install directory for the webapp to
function properly.

But when doing an upgrade of the package it's not supposed to install
the 'install' directory again, as the webapp will recognize the presence
of the directory and fails to function afterwards. 

There are a number of ways on how to approach this, but what is the best

I thought about placing these lines in the %install section:

% define my_home /var/www/html/packagename
if ! [ -d %{my_home} ]; then
  install -m 755 -d $RPM_BUILD_ROOT%{my_home}/install
  %define fresh_install 1

Then in the %files section:

%if %{fresh_install}
  %dir %{my_home}/install

But that doesn't seem to work. 


More information about the Fedora-packaging mailing list