From 589304340e207db76da0baf9f45f8b01929a3ce5 Mon Sep 17 00:00:00 2001 From: Pete Peterson <petersonpf@ornl.gov> Date: Mon, 13 Aug 2018 15:01:45 -0400 Subject: [PATCH] Fix bug in upgrading rpm Because of changing filenames, upgrading the package was broken. It appears to be that the scripts are run in the order of: 1. postinstall of new 2. preuninstall of old 3. postuninstall of old --- .../CMake/Packaging/rpm/scripts/rpm_post_install.sh.in | 9 ++++++--- .../CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in index e5686bffd2f..a611e2c76bf 100644 --- a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in +++ b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_install.sh.in @@ -21,10 +21,13 @@ if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then ln -s $RPM_INSTALL_PREFIX0/@ETC_DIR@/mantid.csh /etc/profile.d/mantid.csh ln -s $RPM_INSTALL_PREFIX0/@ETC_DIR@/mantid.pth @PYTHON_SITE@/mantid.pth else - # Create symbolic links in world's path - if [ ! -L /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ ]; then - ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ + # symbolic links in world's path of mantidplot + if [ -f $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then + if [ ! -L /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ ]; then + ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot /usr/bin/mantidplot@CPACK_PACKAGE_SUFFIX@ + fi fi + # symbolic link for mantidpython if [ ! -L /usr/bin/mantidpython@CPACK_PACKAGE_SUFFIX@ ]; then ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidpython /usr/bin/mantidpython@CPACK_PACKAGE_SUFFIX@ fi diff --git a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in index ade8f26f441..a5e3eba4ac4 100644 --- a/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in +++ b/buildconfig/CMake/Packaging/rpm/scripts/rpm_post_uninstall.sh.in @@ -10,7 +10,7 @@ ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@ # Remove exe and links only if it looks like we were removed # and not upgraded. If launch_mantidplot.sh exists then package # has been upgraded and MantidPlot_exe replaced so don't touch anything -if [ ! -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh ]; then +if [ ! -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then -- GitLab