-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_spm12.sh
executable file
·81 lines (60 loc) · 2.32 KB
/
install_spm12.sh
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
#! /bin/bash
# Time-stamp: <2019-10-03 17:38:26 christophe@pallier.org>
# Download and install SPM12 standalone (no Matlab license required)
# see https://en.wikibooks.org/wiki/SPM/Standalone
set -e
# set -x # echo on for debugging
OWD=$PWD
# Installation directory can be specified as first argument on the command line
# Warning: use a fully qualified path (from root) to correctly set up env variables
if [ $# -eq 0 ]
then
echo "This script downloads and installs SPM12 standalone (https://en.wikibooks.org/wiki/SPM/Standalone)"
read -p "Installation directory? " -e -i "$HOME/opt/spm12" SPM_ROOT_DIR
else
SPM_ROOT_DIR=$1
fi
mkdir -p $SPM_ROOT_DIR
# Download
SPM_SRC=spm12_r????.zip
MCRINST=MCRInstaller.bin
wget -N -r -l1 --no-parent -nd -P $SPM_ROOT_DIR -A.zip -R "index.html*" http://www.fil.ion.ucl.ac.uk/spm/download/restricted/utopia/
# 64bits
#wget -N -r -l1 --no-parent -nd -P $SPM_ROOT_DIR -A.bin http://www.fil.ion.ucl.ac.uk/spm/download/restricted/utopia/MCR/glnxa64/
# 32bits
wget -N -r -l1 --no-parent -nd -P $SPM_ROOT_DIR -A.bin http://www.fil.ion.ucl.ac.uk/spm/download/restricted/utopia/MCR/glnx86
# Install
cd $SPM_ROOT_DIR
unzip -q -u ${SPM_SRC}
chmod 755 spm12/run_spm12.sh
if [ ! -d mcr ]; then
chmod 755 ${MCRINST}
./${MCRINST} -P bean421.installLocation="mcr" -silent
fi
# create start-up script
cat <<EOF > spm12.sh
#!/bin/bash
SPM12_STANDALONE_HOME=$SPM_ROOT_DIR/spm12
exec "\${SPM12_STANDALONE_HOME}/run_spm12.sh" "\${SPM12_STANDALONE_HOME}/../mcr/v713" \${1+"\$@"}
EOF
chmod 755 spm12.sh
if [ ! -f /usr/lib/x86_64-linux-gnu/libXp.so.6 ]; then
echo "IMPORTANT:"
echo "/usr/lib/x86_64-linux-gnu/libXp.so.6 is missing"
echo
echo To install it, you must execute:
echo 'sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu precise-security main"'
echo 'sudo apt update'
echo 'sudo apt install libxp6'
echo 'sudo add-apt-repository -r "deb http://security.ubuntu.com/ubuntu precise-security main"'
echo
fi
# Create CTF
${SPM_ROOT_DIR}/spm12.sh quit
# Create environment variables for pypreprocess
cmds="export SPM_DIR=$SPM_ROOT_DIR/spm12/; export SPM_MCR=$SPM_ROOT_DIR/spm12.sh"
${cmds}
echo "IMPORTANT: pypreprocess will need the SPM_DIR and SPM_MCR variables. you should execute the following line: "
echo
echo "echo \"${cmds}\" >> $HOME/.profile"
cd $OWD