-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·154 lines (105 loc) · 4.47 KB
/
install.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
# REQUIREMENTS: Mac OS X 10.6+, Matlab 2010a or later
# MATLAB Toolboxes: Bioinformatics (SVM), Statistics (GMM), Wavelet (Spike sorting)
# RUN WITH SUDO!
# this install script will configure everything up to the point of installing
# the MCR libraries, which you will need to install for MATLAB 2011a
# two directories we need to symlink are pipeline/bash and pipeline/bash/binscripts
# destination for the symlink
DEST=/usr/local/bin
if [ ! -d $DEST ]; then
mkdir $DEST
fi
echo 'Creating symlinks in ' $DEST
# source 1
BASE=$PWD
COMPILED=$BASE/pipeline/compiled/
if [ -f $DEST/ephys_pipeline_dirs.cfg ];then
source $DEST/ephys_pipeline_dirs.cfg
echo "Local directory: " $LOCAL
for NETDIR in ${NETWORK[@]}; do
echo "Network directory: " $NETDIR
done
echo "Compiled directory: " $COMPILED
echo -n "Overwrite old directories [y/n] (compiled will be overwritten for y or n)? "
read response
COMPILED=$BASE/pipeline/compiled/
case "$response" in
"y" | "Y" )
echo "Replacing directories..."
echo -n "Enter network directory with Intan files and press [ENTER] (leave blank to set later or if you want to sync multiple directories): "
read networkdir
# read out user directories
echo -n "Enter local directory where you would like to store the Intan files and press [ENTER] (leave blank to set later): "
read localdir
echo "LOCAL=$localdir" > $DEST/ephys_pipeline_dirs.cfg
echo "COMPILED=$COMPILED" >> $DEST/ephys_pipeline_dirs.cfg
echo "# set NETWORK to an array to sync multiple directories" >> $DEST/ephys_pipeline_dirs.cfg
echo "# e.g. NETWORK[1]=/path/to/dir" >> $DEST/ephys_pipeline_dirs.cfg
echo "# NETWORK[2]=/path/to/other/dir" >> $DEST/ephys_pipeline_dirs.cfg
echo "NETWORK=$networkdir" >> $DEST/ephys_pipeline_dirs.cfg
;;
* )
echo "Not replacing directories..."
# always update the compiled directory
sed -i '' "s|\(COMPILED\=\).*|\1$COMPILED|" $DEST/ephys_pipeline_dirs.cfg
COUNTER=1
;;
esac
else
echo "Replacing directories..."
echo -n "Enter network directory with Intan files and press [ENTER] (leave blank to set later or if you want to sync multiple directories): "
read networkdir
# read out user directories
echo -n "Enter local directory where you would like to store the Intan files and press [ENTER] (leave blank to set later): "
read localdir
echo "LOCAL=$localdir" > $DEST/ephys_pipeline_dirs.cfg
echo "COMPILED=$COMPILED" >> $DEST/ephys_pipeline_dirs.cfg
echo "# set NETWORK to an array to sync multiple directories" >> $DEST/ephys_pipeline_dirs.cfg
echo "# e.g. NETWORK[1]=/path/to/dir" >> $DEST/ephys_pipeline_dirs.cfg
echo "# NETWORK[2]=/path/to/other/dir" >> $DEST/ephys_pipeline_dirs.cfg
echo "NETWORK=$networkdir" >> $DEST/ephys_pipeline_dirs.cfg
fi
SOURCE=$BASE/pipeline/bash
cd -- "$SOURCE"
# changed to interactive to not overwrite important files
find . -type f -maxdepth 1 -exec ln -sf -- "$SOURCE"/{} "$DEST"/{} \;
# source 2
SOURCE=$BASE/pipeline/bash/binscripts
cd -- "$SOURCE"
find . -type f -maxdepth 1 -exec ln -sf -- "$SOURCE"/{} "$DEST"/{} \;
# query the user for updating the settings files, also for updating the extras
echo -n "Do you want to replace your settings [y/n] (this will overwrite your old settings, enter y if installing for the first time)? "
read response
# don't use symlinks for settings so that they're preserved through updates
case "$response" in
"y" | "Y" )
echo "Replacing settings..."
rm /usr/local/bin/ephys_pipeline.cfg
rm /usr/local/bin/ephys_pipeline_wrapper.cfg
cp $BASE/pipeline/bash/settings/*.cfg /usr/local/bin
;;
* )
echo "Not replacing settings..."
;;
esac
echo -n "Do you want to overwrite the extras [y/n] (this will overwrite data_sync.sh and screenrc, enter y if installing for the first time)? "
read response
case "$response" in
"y" | "Y" )
echo "Replacing extras..."
SOURCE=$BASE/pipeline/bash/extras
cd -- "$SOURCE"
find . -type f -maxdepth 1 -exec ln -sf -- "$SOURCE"/{} "$DEST"/{} \;
;;
* )
echo "Not replacing extras..."
;;
esac
# inform user to add /usr/local/bin/ to PATH
echo 'To finish the installation: '
echo '1) Add /usr/local/bin/ to your PATH in ~/.profile'
echo '2) Change any settings in ephys_pipeline_wrapper.cfg or ephys_pipeline.cfg if they are not to your liking (in ' $DEST ')'
echo '3) Install the Matlab 2011b MCR and add the environment variables to ~/.profile'
echo '4) Run ephys_pipeline_wrapper.sh from the command line to start'
echo '5) Add ephys and all subdirectories to your MATLAB path'