|
1 | 1 | #! /bin/bash |
| 2 | +# Time-stamp: <2018-02-14 11:26:59 cp983411> |
| 3 | + |
| 4 | +# Download and install SPM12 standalone (no Matlab license required) |
| 5 | +# see https://en.wikibooks.org/wiki/SPM/Standalone |
| 6 | + |
2 | 7 | set -e |
| 8 | +# set -x # echo on for debugging |
3 | 9 |
|
4 | | -# set -x # echo on |
| 10 | +# Installation directory can be specified as first argument on the command line |
| 11 | +# Warning: use a fully qualitifed path (from root) to correctly set up env variables |
| 12 | + |
| 13 | +if [ $# -eq 0 ] |
| 14 | + then |
| 15 | + SPM_ROOT_DIR=$HOME/opt/spm12 # default |
| 16 | +else |
| 17 | + SPM_ROOT_DIR=$1 |
| 18 | +fi |
5 | 19 |
|
6 | | -SPM_ROOT_DIR=~/opt/spm12 # Installation directory |
| 20 | +mkdir -p $SPM_ROOT_DIR |
7 | 21 |
|
8 | | -SPM_SRC=spm12_r7219.zip # this used to be spm12_r6914.zip, watch out it might get pulled down again!!! |
| 22 | +# Download |
| 23 | +SPM_SRC=spm12_r????.zip |
9 | 24 | MCRINST=MCRInstaller.bin |
10 | 25 |
|
11 | | -mkdir -p $SPM_ROOT_DIR && cd $SPM_ROOT_DIR |
| 26 | +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/ |
12 | 27 |
|
13 | | -if [ ! -d spm12 ]; then |
14 | | - if [ ! -f ${SPM_SRC} ]; then |
15 | | - wget http://www.fil.ion.ucl.ac.uk/spm/download/restricted/utopia/${SPM_SRC} |
16 | | - fi |
17 | | - unzip -q ${SPM_SRC} |
18 | | - chmod 755 spm12/run_spm12.sh |
19 | | -fi |
| 28 | +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/ |
20 | 29 |
|
21 | | -if [ ! -d mcr ]; then |
22 | | - if [ ! -f MCRInstaller.bin ]; then |
23 | | - wget http://www.fil.ion.ucl.ac.uk/spm/download/restricted/utopia/MCR/glnxa64/${MCRINST} |
24 | | - fi |
25 | | - chmod 755 ${MCRINST} |
26 | | - ./${MCRINST} -P bean421.installLocation="mcr" -silent |
27 | | -fi |
28 | 30 |
|
| 31 | +# Install |
| 32 | +cd $SPM_ROOT_DIR |
| 33 | +unzip -q -u ${SPM_SRC} |
| 34 | +chmod 755 spm12/run_spm12.sh |
29 | 35 |
|
30 | | -if [ ! -f $SPM_ROOT_DIR/spm12.sh ]; then |
31 | | - cat <<EOF > $SPM_ROOT_DIR/spm12.sh |
| 36 | +if [ ! -d mcr ]; then |
| 37 | + chmod 755 ${MCRINST} |
| 38 | + ./${MCRINST} -P bean421.installLocation="mcr" -silent |
| 39 | +fi |
| 40 | + |
| 41 | +# create start-up script |
| 42 | +cat <<EOF > spm12.sh |
32 | 43 | #!/bin/bash |
33 | 44 | SPM12_STANDALONE_HOME=$SPM_ROOT_DIR/spm12 |
34 | 45 | exec "\${SPM12_STANDALONE_HOME}/run_spm12.sh" "\${SPM12_STANDALONE_HOME}/../mcr/v713" \${1+"\$@"} |
35 | 46 | EOF |
36 | 47 |
|
37 | | - chmod 755 $SPM_ROOT_DIR/spm12.sh |
| 48 | +chmod 755 spm12.sh |
| 49 | + |
| 50 | +if [ ! -f /usr/lib/x86_64-linux-gnu/libXp.so.6 ]; then |
| 51 | + echo "WARNING!!!" |
| 52 | + echo "/usr/lib/x86_64-linux-gnu/libXp.so.6 is missing" |
| 53 | + echo |
| 54 | + echo To install it: |
| 55 | + echo 'sudo add-apt-repository "deb http://securuty.ubuntu.com/ubuntu precise-security main"' |
| 56 | + echo 'sudo apt update' |
| 57 | + echo 'sudo apt install lixp6' |
| 58 | + echo 'sudo add-apt-repository -r "deb http://securuty.ubuntu.com/ubuntu precise-security main"' |
38 | 59 | fi |
39 | 60 |
|
40 | 61 | # Create CTF |
41 | | -$SPM_ROOT_DIR/spm12.sh quit |
| 62 | +${SPM_ROOT_DIR}/spm12.sh quit |
42 | 63 | cmds="export SPM_DIR=$SPM_ROOT_DIR/spm12/; export SPM_MCR=$SPM_ROOT_DIR/spm12.sh" |
43 | 64 | ${cmds} |
44 | | -echo "You may want to add the following commands (the exports) to your ~/.bashrc file once and for all." |
45 | 65 | echo |
46 | 66 | echo ${cmds} |
| 67 | +echo "IMPORTANT: you should now execute the following line: " |
| 68 | +echo "echo ${cmds} >> $HOME/.bashrc" |
| 69 | + |
| 70 | + |
| 71 | + |
0 commit comments