[opensuse-buildservice] perhaps OT spec file question
Hi, I tried to define a "var" in %pre, hoping that this "var" is then known in %post. Example: %pre if [ ${1:-0} -gt 1 ]; then # get version of previuos installed package pre_version=`rpm -q --qf "%{VERSION}" %{name}` fi %post if [ ${1:-0} -gt 1 ]; then if [ -n $pre_version ]; then if [ "$pre_version" = "%{version}" ]; then do stuff fi fi fi but "$pre_version" is not known in %post. I also tried "export pre_version=`.....` with no success. Any Idea ? Kind Regards Chris -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On Wed, May 27, 2009 at 11:05:31AM +0200, Christian wrote:
Hi,
I tried to define a "var" in %pre, hoping that this "var" is then known in %post.
Example: %pre if [ ${1:-0} -gt 1 ]; then # get version of previuos installed package pre_version=`rpm -q --qf "%{VERSION}" %{name}` fi
%post if [ ${1:-0} -gt 1 ]; then if [ -n $pre_version ]; then if [ "$pre_version" = "%{version}" ]; then do stuff fi fi fi
but "$pre_version" is not known in %post. I also tried "export pre_version=`.....` with no success.
Any Idea ?
You cannot test for this, you might have more than 1 or random previous versions... What do you actually _want_ to do? Ciao, Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On Wed, May 27, 2009 at 11:05:31AM +0200, Christian wrote:
I tried to define a "var" in %pre, hoping that this "var" is then known in %post.
Example: %pre if [ ${1:-0} -gt 1 ]; then # get version of previuos installed package pre_version=`rpm -q --qf "%{VERSION}" %{name}` fi
%post if [ ${1:-0} -gt 1 ]; then if [ -n $pre_version ]; then if [ "$pre_version" = "%{version}" ]; then do stuff fi fi fi
but "$pre_version" is not known in %post. I also tried "export pre_version=`.....` with no success.
You have to store the information in the filesystem. Do something like echo "${pre_version}" >/var/adm/rpm_updates_are_sometimes_a_source_of_big_pain from inside %pre and source this file later in %post to check your condition. You can't even use mktemp (1) cause there is no way to transport the given name from %pre to %post. Please ensure your knees are bullet proofed! ;) Lars -- Lars Müller [ˈlaː(r)z ˈmʏlɐ] Samba Team SUSE Linux, Maxfeldstraße 5, 90409 Nürnberg, Germany
Lars Müller schrieb:
You have to store the information in the filesystem. Do something like
echo "${pre_version}" >/var/adm/rpm_updates_are_sometimes_a_source_of_big_pain
from inside %pre and source this file later in %post to check your condition.
You can't even use mktemp (1) cause there is no way to transport the given name from %pre to %post. Yes, this is the way I'm currently using. Just thought there is a more comfortable way of doing it.
Thanks for your response
Please ensure your knees are bullet proofed! ;)
Hope so ;) Chris -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Christian escribió:
Hi,
I tried to define a "var" in %pre, hoping that this "var" is then known in %post.
No, unless this is vital to get a working application, avoid %pre and %post scripts, those are a good source of permanent pain. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (4)
-
Christian
-
Cristian Rodríguez
-
Lars Müller
-
Marcus Meissner