-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Debian pre & post install scripts
Refs #10271
- Loading branch information
1 parent
fa84dd3
commit 91db9e8
Showing
3 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Code/Mantid/Build/CMake/Packaging/deb/scripts/deb_pre_inst.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
# postinst script for mantid | ||
# | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <new-preinst> `install' | ||
# * <new-preinst> `install' <old-version> | ||
# * <new-preinst> `upgrade' <old-version> | ||
# * <old-preinst> `abort-upgrade' <new-version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
# Configured by cmake | ||
ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@ | ||
|
||
case "$1" in | ||
install|upgrade) | ||
# Remove stale links if left around | ||
if [ -h @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/mantidplot ]; then | ||
rm @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/mantidplot | ||
fi | ||
if [ -h @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot ]; then | ||
rm @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot | ||
fi | ||
# Stale _exe | ||
if [ -f @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe ]; then | ||
rm @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe | ||
fi | ||
|
||
if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then | ||
# Profiles | ||
if [ -h /etc/profile.d/mantid.sh ]; then | ||
rm /etc/profile.d/mantid.sh | ||
fi | ||
if [ -h /etc/profile.d/mantid.csh ]; then | ||
rm /etc/profile.d/mantid.csh | ||
fi | ||
fi | ||
;; | ||
|
||
abort-upgrade) | ||
;; | ||
|
||
*) | ||
echo "preinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
51 changes: 51 additions & 0 deletions
51
Code/Mantid/Build/CMake/Packaging/deb/scripts/deb_pre_rm.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
# postinst script for mantid | ||
# | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <prerm> `remove' | ||
# * <old-prerm> `upgrade' <new-version> | ||
# * <new-prerm> `failed-upgrade' <old-version> | ||
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> | ||
# * <deconfigured's-prerm> `deconfigure' `in-favour' | ||
# <package-being-installed> <version> `removing' | ||
# <conflicting-package> <version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
# Configured by cmake | ||
ENVVARS_ON_INSTALL=@ENVVARS_ON_INSTALL_INT@ | ||
|
||
case "$1" in | ||
remove|upgrade|deconfigure) | ||
# Remove links and _exe in package directory | ||
if [ -h @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/mantidplot ]; then | ||
rm @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/mantidplot | ||
fi | ||
if [ -f @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe ]; then | ||
rm @CMAKE_INSTALL_PREFIX@/@BIN_DIR@/MantidPlot_exe | ||
fi | ||
|
||
# If we were configured to install profile scripts, remove them | ||
if [ ${ENVVARS_ON_INSTALL} -eq 1 ]; then | ||
if [ -h /etc/profile.d/mantid.sh ]; then | ||
rm /etc/profile.d/mantid.sh | ||
fi | ||
if [ -h /etc/profile.d/mantid.csh ]; then | ||
rm /etc/profile.d/mantid.csh | ||
fi | ||
fi | ||
;; | ||
|
||
failed-upgrade) | ||
;; | ||
|
||
*) | ||
echo "prerm called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |