-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install HOLE for full tests (see #898)
- Loading branch information
Showing
2 changed files
with
97 additions
and
0 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
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,86 @@ | ||
#!/bin/bash | ||
# Install HOLE from http://www.smartsci.uk/hole/ | ||
# | ||
# arguments | ||
# OSNAME : linux | darwin | ||
# PREFIX : "path/to/installdir" | ||
# | ||
# PREFIX can be relative to HOME or an absolute path; it will be created | ||
# and HOLE unpacked under PREFIX (the tar file contains "hole2/...") | ||
|
||
set -o errexit -o nounset | ||
|
||
SCRIPT=$(basename $0) | ||
|
||
DOWNLOAD_URL_LINUX='https://www.dropbox.com/s/jukpwlohhi20r17/hole2-NotForProfit-2.2.004-Linux-x86_64.tar.gz?dl=1' | ||
TARFILE_LINUX='hole2-NotForProfit-2.2.004-Linux-x86_64.tar.gz' | ||
|
||
DOWNLOAD_URL_DARWIN='https://www.dropbox.com/s/5mzrsyp48i32je4/hole2-NotForProfit-2.2.004-Darwin-i386.tar.gz?dl=1' | ||
TARFILE_DARWIN=hole2-NotForProfit-2.2.004-Darwin-i386.tar.gz | ||
|
||
# path to dir with executables in the current HOLE distribution | ||
HOLE_EXE_DIR=hole2/exe | ||
|
||
function die () { | ||
local msg="$1" err=$2 | ||
echo "[${SCRIPT}] ERROR: $msg [$err]" | ||
exit $err | ||
} | ||
|
||
function is_native_executable () { | ||
local filename="$1" OSNAME="$2" | ||
file "${filename}" | grep -qi ${OFORMAT} | ||
return $? | ||
} | ||
|
||
OSNAME="$1" | ||
case "$OSNAME" in | ||
Linux|linux) | ||
OSNAME=Linux | ||
OFORMAT=Linux | ||
DOWNLOAD_URL="${DOWNLOAD_URL_LINUX}" | ||
TARFILE=${TARFILE_LINUX} | ||
;; | ||
OSX|osx|Darwin|darwin) | ||
OSNAME=Darwin | ||
OFORMAT="Mach-O" | ||
DOWNLOAD_URL="${DOWNLOAD_URL_DARWIN}" | ||
TARFILE=${TARFILE_DARWIN} | ||
;; | ||
*) | ||
die "OS '${OSNAME}' not supported." 10;; | ||
esac | ||
|
||
PREFIX="$2" | ||
test -n "$PREFIX" || die "missing second argument PREFIX (installation directory)" 10 | ||
|
||
#------------------------------------------------------------ | ||
# start installation | ||
#------------------------------------------------------------ | ||
|
||
cd ~ | ||
mkdir -p "$PREFIX" && cd "$PREFIX" || die "Failed to create and cd to $PREFIX" 1 | ||
test -f ${TARFILE} || \ | ||
curl -L ${DOWNLOAD_URL} -o ${TARFILE} || \ | ||
die "Failed to download ${TARFILE} from ${DOWNLOAD_URL}" 1 | ||
|
||
# only install the executables in HOLE_EXE_DIR | ||
tar xvf ${TARFILE} ${HOLE_EXE_DIR} || die "Failed 'tar xvf ${TARFILE} ${HOLE_EXE_DIR}'" 1 | ||
|
||
MDA_HOLE_BINDIR="${PWD}/${HOLE_EXE_DIR}" | ||
HOLE_EXE="${MDA_HOLE_BINDIR}/hole" | ||
|
||
test -d "${MDA_HOLE_BINDIR}" || { \ | ||
echo "Content of ${PWD}:"; | ||
ls -la; | ||
die "no HOLE exe dir ${MDA_HOLE_BINDIR} in $PWD" 2; } | ||
test -f "${HOLE_EXE}" || die "hole executable ${HOLE_EXE} not installed" 2 | ||
is_native_executable ${HOLE_EXE} ${OFORMAT} || \ | ||
{ file ${HOLE_EXE}; \ | ||
die "${HOLE_EXE} will not run on ${OSNAME} (object format ${OFORMAT})" 3; } | ||
|
||
echo "HOLE executables were installed into ${MDA_HOLE_BINDIR}" | ||
echo ">>> export PATH=\${PATH}:${MDA_HOLE_BINDIR}" | ||
|
||
# repeat this line in .travis.yml | ||
export PATH=${PATH}:${MDA_HOLE_BINDIR} |