Hi,
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 method?
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 fi
Then in the %files section:
%if %{fresh_install} %dir %{my_home}/install %endif
But that doesn't seem to work.
Léon Keijser wrote:
Hi,
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 method?
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 fi
Then in the %files section:
%if %{fresh_install} %dir %{my_home}/install %endif
But that doesn't seem to work.
Check this out:
http://docs.fedoraproject.org/drafts/rpm-guide-en/ch09s04.html#id2972291
You can create a script to test if it's an upgrade and if it is, remove the install. Such as:
%post
if [ "$1" = 2 ]; then
rm -rf /path/to/install/thingy
fi
exit 0
And then maybe in $files
%ghost /path/to/install/thingy
But I'm not sure about the last part. No coffee yet.
-J
On Thu, 2009-12-17 at 07:41 -0600, Jon Ciesla wrote:
Check this out:
http://docs.fedoraproject.org/drafts/rpm-guide-en/ch09s04.html#id2972291
You can create a script to test if it's an upgrade and if it is, remove the install. Such as:
%post
if [ "$1" = 2 ]; then
rm -rf /path/to/install/thingy
fi
exit 0
I didn't know about that yet, thanks! Works like a charm. The %ghost line made yum complain a lot when installing the rpm, so i just left the subdir out and included everything in the toplevel dir. Don't know why i specified each subdir seperately in %files.
packaging@lists.fedoraproject.org