-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathinstall
More file actions
executable file
·94 lines (81 loc) · 2.24 KB
/
install
File metadata and controls
executable file
·94 lines (81 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
# This script install singularity
function print_usage () {
echo "This script download singularity, compile and installs it"
echo "root prividge is needed as some files need to be installed with suid. eg:"
echo "sudo ./install will install to /usr/local/singularity-\$BUILD"
echo "sudo ./install --prefix=/opt --build=2.4.alpha will install to /opt/singularity-2.4.alpha"
}
### process command line arguments ###
# option parsing ref:
# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
for i in "$@"; do
case $i in
-p=*|--prefix=*)
PREFIX="${i#*=}"
shift # past argument=value
;;
-b=*|--build=*)
#BUILD="${i#*=}"
BUILD="${i#*=}"
shift # past argument=value
;;
-h|--help)
print_usage
exit 255
;;
*)
echo "Unknown argument. Use -h for help"
exit 255
;;
esac
done
### actual install ###
PREFIX="${PREFIX:-/usr/local}" # default install to /usr/local unless otherwise specified
#VER="{VER:-}"
if [[ x${BUILD} == "x" ]] ; then
BUILD=$(date "+%Y.%m%d")
fi
INSTALLDIR=${PREFIX}/singularity-${BUILD}
echo "This script install singularity to ${INSTALLDIR}"
echo "Press ^C in the next 15 seconds to cancel"
sleep 15
#echo "Press ^C to cancel or the ANY key to continue..."
#read CONFIRM
echo "installing..."
if [[ ! -d ${INSTALLDIR} ]]; then
mkdir -p ${INSTALLDIR}
EXITCODE=$?
if [[ $EXITCODE -gt 0 ]]; then
echo "Unable to create ${INSTALLDIR}. Exiting."
exit $EXITCODE
fi
fi
GITSOURCE=${INSTALLDIR}/github
if [[ ! -d ${GITSOURCE} ]] ; then
# singularity never pulled from github, setting it up now
mkdir ${GITSOURCE}
cd ${GITSOURCE}
git clone https://github.com/singularityware/singularity.git
else
# update code before install
cd ${GITSOURCE}/singularity
git pull
fi
cd ${GITSOURCE}/singularity
./autogen.sh
EXITCODE=$?
if [[ $EXITCODE -gt 0 ]]; then
echo "autogen didn't work correctly. "
echo "Please make sure the following packages are installed: libtool automake autoconf"
exit $EXITCODE
fi
./configure --prefix=${INSTALLDIR}
make
sudo make install
EXITCODE=$?
if [[ $EXITCODE -eq 0 ]]; then
echo "Done. Singularity installed to ${INSTALLDIR}."
else
echo "Something didn't go right, Singularity install exits with ${EXITCODE}."
fi