From faffd5bcd65278f3a0c980d1b19c86fdafa8967c Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Thu, 31 Jan 2019 10:45:05 +0100 Subject: [PATCH] CPack post (un)install add post (un)install scripts to musrfit cpack. Currently for rpm only. Furthermore a minimal required root version is added. Will need to see if this is sufficient or if more detailed work needs to be added. --- cmake/CPackOptions.cmake.in | 7 +++++-- cmake/post_install.sh | 14 ++++++++++++++ cmake/post_uninstall.sh | 13 +++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 cmake/post_install.sh create mode 100644 cmake/post_uninstall.sh diff --git a/cmake/CPackOptions.cmake.in b/cmake/CPackOptions.cmake.in index 7654ae58..1d24ed67 100644 --- a/cmake/CPackOptions.cmake.in +++ b/cmake/CPackOptions.cmake.in @@ -24,13 +24,16 @@ set (CPACK_SET_DESTDIR "OFF") set (CPACK_PACKAGE_RELOCATABLE "true") if (${CPACK_GENERATOR} STREQUAL "RPM") - set(CPACK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") - set(CPACK_PACKAGING_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") + set (CPACK_RPM_PACKAGE_REQUIRES "root >= 6.14.08") + set (CPACK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") + set (CPACK_PACKAGING_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") set (CPACK_RPM_FILE_NAME "RPM-DEFAULT") set (CPACK_RPM_PACKAGE_RELEASE "1") set (CPACK_RPM_PACKAGE_LICENSE "GPLv2") set (CPACK_RPM_PACKAGE_VENDOR "Paul Scherrer Institute - LMU - LEM") set (CPACK_RPM_CHANGELOG_FILE "@PROJECT_SOURCE_DIR@/cmake/ChangeLogRPM") + set (CPACK_RPM_POST_INSTALL_SCRIPT_FILE "@PROJECT_SOURCE_DIR@/cmake/post_install.sh") + set (CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "@PROJECT_SOURCE_DIR@/cmake/post_uninstall.sh") endif () if (${CPACK_GENERATOR} STREQUAL "DEB") diff --git a/cmake/post_install.sh b/cmake/post_install.sh new file mode 100644 index 00000000..3763661a --- /dev/null +++ b/cmake/post_install.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo ">> musrfit post install script started ..." + +# test if nemu-x86_64.conf does not exist +if [ ! -f "/etc/ld.so.conf.d/nemu-x86_64.conf" ] +then + echo "/usr/local/lib" >> /etc/ld.so.conf.d/nemu-x86_64.conf + echo "/usr/local/lib64" >> /etc/ld.so.conf.d/nemu-x86_64.conf +fi +/sbin/ldconfig + +echo ">> musrfit post install script done." + diff --git a/cmake/post_uninstall.sh b/cmake/post_uninstall.sh new file mode 100644 index 00000000..51390702 --- /dev/null +++ b/cmake/post_uninstall.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo ">> musrfit post uninstall script started ..." + +# test if nemu-x86_64.conf does not exist +if [ -f "/etc/ld.so.conf.d/nemu-x86_64.conf" ] +then + rm -f /etc/ld.so.conf.d/nemu-x86_64.conf +fi +/sbin/ldconfig + +echo ">> musrfit post uninstall script done." +