From 2d24a9dbe317c0a7308fc9050e302f8cb84e9503 Mon Sep 17 00:00:00 2001 From: Alexander Kislitsky Date: Wed, 6 Apr 2016 17:54:16 +0300 Subject: [PATCH] We shouldn't execute uninstall.sh on plugin upgrade When package is upgraded the following steps are perfored: - Run the %pre section of the RPM being installed. - Install the files that the RPM provides. - Run the %post section of the RPM. - Run the %preun of the old package. - Delete any old files not overwritten by the newer version. (This step deletes files that the new package does not require.) - Run the %postun hook of the old package. uninstall_hook should be executed only when package removing is performed. Otherwise in case of upgrade plugin changes made in post-install.sh can be removed by unistall.sh Change-Id: Idba866be2556aacc9ac0abeff67afcf34f02d93b Closes-Bug: #1564123 --- .../templates/v3/build/plugin_rpm.spec.mako | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fuel_plugin_builder/templates/v3/build/plugin_rpm.spec.mako b/fuel_plugin_builder/templates/v3/build/plugin_rpm.spec.mako index f7e8f86..37dcab5 100644 --- a/fuel_plugin_builder/templates/v3/build/plugin_rpm.spec.mako +++ b/fuel_plugin_builder/templates/v3/build/plugin_rpm.spec.mako @@ -44,7 +44,14 @@ ${ preinstall_hook } ${ postinstall_hook } %%preun -${ uninstall_hook } +# Values of $1: +# install: (N/A) +# upgrade: 1 +# uninstall: 0 +if [ $1 -eq 0 ]; then + ${ uninstall_hook } +fi + %%files /var/www/nailgun/plugins/${ name }