Skip to content

Commit

Permalink
Use RPM_INSTALL_PREFIX0 directly in rpm maintainer scripts
Browse files Browse the repository at this point in the history
Refs #10271
  • Loading branch information
martyngigg committed Nov 25, 2014
1 parent ef214ae commit 7705506
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
16 changes: 7 additions & 9 deletions Code/Mantid/Build/CMake/LinuxPackageScripts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ set ( PRE_UNINSTALL_FILE ${CMAKE_CURRENT_BINARY_DIR}/prerm )
set ( POST_UNINSTALL_FILE ${CMAKE_CURRENT_BINARY_DIR}/postrm )

if ( "${UNIX_DIST}" MATCHES "RedHatEnterprise" OR "${UNIX_DIST}" MATCHES "^Fedora" ) # RHEL/Fedora
set ( PKG_INSTALL_PREFIX \$RPM_INSTALL_PREFIX0 ) # used in mainter scripts
if ( "${UNIX_CODENAME}" MATCHES "Santiago" ) # el6
set ( MANTIDPLOT_LAUNCHER_PREFIX
"LD_PRELOAD=\${EXTRA_LDPRELOAD_LIBS} scl enable mantidlibs" )
else()
set ( MANTIDPLOT_LAUNCHER_PREFIX
"LD_PRELOAD=\${EXTRA_LDPRELOAD_LIBS} LD_LIBRARY_PATH=/usr/lib64/paraview:${LD_LIBRARY_PATH} eval" ) # LD_PATH hack for non-official ParaView
endif()

if ( NOT MPI_BUILD )
configure_file ( ${CMAKE_MODULE_PATH}/Packaging/rpm/scripts/rpm_pre_install.sh.in
Expand All @@ -100,14 +106,6 @@ if ( "${UNIX_DIST}" MATCHES "RedHatEnterprise" OR "${UNIX_DIST}" MATCHES "^Fedor
set ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${PRE_UNINSTALL_FILE} )
set ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${POST_UNINSTALL_FILE} )
endif()

if ( "${UNIX_CODENAME}" MATCHES "Santiago" ) # el6
set ( MANTIDPLOT_LAUNCHER_PREFIX
"LD_PRELOAD=\${EXTRA_LDPRELOAD_LIBS} scl enable mantidlibs" )
else()
set ( MANTIDPLOT_LAUNCHER_PREFIX
"LD_PRELOAD=\${EXTRA_LDPRELOAD_LIBS} LD_LIBRARY_PATH=/usr/lib64/paraview:${LD_LIBRARY_PATH} eval" ) # LD_PATH hack for non-official ParaView
endif()
elseif ( "${UNIX_DIST}" MATCHES "Ubuntu" )
set ( MANTIDPLOT_LAUNCHER_PREFIX "LD_PRELOAD=${EXTRA_LDPRELOAD_LIBS} eval" )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#
ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@

if [ ! -e @PKG_INSTALL_PREFIX@/@BIN_DIR@/mantidplot ]; then
ln -s @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot @PKG_INSTALL_PREFIX@/@BIN_DIR@/mantidplot
if [ ! -e $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then
ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot
fi

if [ -f @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot ]; then
mv @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe
ln -s @PKG_INSTALL_PREFIX@/@BIN_DIR@/launch_mantidplot.sh @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot
if [ -f $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot ]; then
mv $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe
ln -s $RPM_INSTALL_PREFIX0/@BIN_DIR@/launch_mantidplot.sh $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot
fi

if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then
# Link profiles to /etc/profile.d
ln -s @PKG_INSTALL_PREFIX@/@ETC_DIR@/mantid.sh /etc/profile.d/mantid.sh
ln -s @PKG_INSTALL_PREFIX@/@ETC_DIR@/mantid.csh /etc/profile.d/mantid.csh
ln -s $RPM_INSTALL_PREFIX0/@ETC_DIR@/mantid.sh /etc/profile.d/mantid.sh
ln -s $RPM_INSTALL_PREFIX0/@ETC_DIR@/mantid.csh /etc/profile.d/mantid.csh
fi
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

# If the install prefix contains mantid then prune empty directories.
# Begin extra cautious here just in case some has set the something like Prefix=/usr
if echo \"@PKG_INSTALL_PREFIX@\" | grep -qi mantid; then
find @PKG_INSTALL_PREFIX@ -mindepth 1 -type d -empty -delete
rmdir --ignore-fail-on-non-empty -p @PKG_INSTALL_PREFIX@
if echo \"$RPM_INSTALL_PREFIX0\" | grep -qi mantid; then
find $RPM_INSTALL_PREFIX0 -mindepth 1 -type d -empty -delete
rmdir --ignore-fail-on-non-empty -p $RPM_INSTALL_PREFIX0
else
echo Install prefix does not contain the word mantid. Empty directories NOT removed.
fi
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#
ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@

if [ -h @PKG_INSTALL_PREFIX@/@BIN_DIR@/mantidplot ]; then
rm @PKG_INSTALL_PREFIX@/@BIN_DIR@/mantidplot
if [ -h $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then
rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot
fi

if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@

# Remove link and exe
if [ -h @PKG_INSTALL_PREFIX@/@BIN_DIR@/mantidplot ]; then
rm @PKG_INSTALL_PREFIX@/@BIN_DIR@/mantidplot
if [ -h $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot ]; then
rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/mantidplot
fi
if [ -f @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe ]; then
rm @PKG_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe
if [ -f $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe ]; then
rm $RPM_INSTALL_PREFIX0/@BIN_DIR@/MantidPlot_exe
fi

if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then
Expand Down

0 comments on commit 7705506

Please sign in to comment.