You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ok...@apache.org on 2018/10/03 06:09:25 UTC

madlib git commit: Upgrade: Fix issue with upgrading RPM to 1.15.1

Repository: madlib
Updated Branches:
  refs/heads/master 8182215f1 -> d95dcfa25


Upgrade: Fix issue with upgrading RPM to 1.15.1

JIRA: MADLIB-1278

During RPM upgrade, rpm_post.sh is run first, followed by
rpm_post_uninstall.sh. So we must do all the uninstallation specific
stuff based on the current operation being uninstall or upgrade.
This commit makes the necessary change to remove symlinks only during
uninstallation, and not while upgrading.

Closes #327

Co-authored-by: Domino Valdano <dv...@pivotal.io>


Project: http://git-wip-us.apache.org/repos/asf/madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/madlib/commit/d95dcfa2
Tree: http://git-wip-us.apache.org/repos/asf/madlib/tree/d95dcfa2
Diff: http://git-wip-us.apache.org/repos/asf/madlib/diff/d95dcfa2

Branch: refs/heads/master
Commit: d95dcfa25a719c84c143f7566cee81e0edb43321
Parents: 8182215
Author: Nandish Jayaram <nj...@apache.org>
Authored: Mon Oct 1 14:32:44 2018 -0700
Committer: Orhan Kislal <ok...@apache.org>
Committed: Wed Oct 3 09:08:26 2018 +0300

----------------------------------------------------------------------
 deploy/rpm_post_uninstall.sh | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/madlib/blob/d95dcfa2/deploy/rpm_post_uninstall.sh
----------------------------------------------------------------------
diff --git a/deploy/rpm_post_uninstall.sh b/deploy/rpm_post_uninstall.sh
index c67fd34..9123efc 100755
--- a/deploy/rpm_post_uninstall.sh
+++ b/deploy/rpm_post_uninstall.sh
@@ -17,10 +17,22 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# remove symlinks created during rpm install
-find $RPM_INSTALL_PREFIX/madlib/Current -depth -type l -exec rm {} \; 2>/dev/null
-find $RPM_INSTALL_PREFIX/madlib/bin -depth -type l -exec rm {} \; 2>/dev/null
-find $RPM_INSTALL_PREFIX/madlib/doc -depth -type l -exec rm {} \; 2>/dev/null
+##############################################################
+#### During RPM upgrade, rpm_post.sh is run first, followed by
+## rpm_post_uninstall.sh. So we must do all the uninstallation specific stuff
+## based on the current operation being uninstall or upgrade.
 
-# remove "Versions" directory if it's empty
-rmdir $RPM_INSTALL_PREFIX/madlib/Versions 2>/dev/null
+# If the first argument to %preun and %postun is 1, the action is an upgrade
+# If the first argument to %preun and %postun is 0, the action is uninstallation
+##############################################################
+if [ "$1" = "0" ]; then
+    # remove symlinks created during rpm install
+    find $RPM_INSTALL_PREFIX/madlib/Current -depth -type l -exec rm {} \; 2>/dev/null
+    find $RPM_INSTALL_PREFIX/madlib/bin -depth -type l -exec rm {} \; 2>/dev/null
+    find $RPM_INSTALL_PREFIX/madlib/doc -depth -type l -exec rm {} \; 2>/dev/null
+
+    # remove "Versions" directory if it's empty
+    if [ -d $RPM_INSTALL_PREFIX/madlib/Versions ]; then
+        rmdir $RPM_INSTALL_PREFIX/madlib/Versions 2>/dev/null
+    fi
+fi