forked from aces/Loris-MRI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimaging_install_MacOSX.sh
executable file
·90 lines (75 loc) · 4.43 KB
/
imaging_install_MacOSX.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
#!/bin/bash
##################################
###WHAT THIS SCRIPT WILL NOT DO###
#1)It doesn't set up the SGE
#2)It doesn't fetch the CIVET stuff TODO:Get the CIVET stuff from somewhere and place somewhere
#3)It doesn't change the config.xml
#Create a temporary log for installation and delete it on completion
#@TODO make sure that /tmp is writable
LOGFILE="/tmp/$(basename $0).$$.tmp"
touch $LOGFILE
trap "rm $LOGFILE" EXIT
read -p "What is the database name? " mysqldb
read -p "What is the database host? " mysqlhost
read -p "What is the MySQL user? " mysqluser
stty -echo
read -p "What is the MySQL password? " mysqlpass; echo
stty echo
read -p "What is the Linux user which the installation will be based on? " USER
read -p "What is the project name? " PROJ ##this will be used to create all the corresponding directories...i.e /data/gusto/bin.....
read -p "What is your email address? " email
read -p "What prod file name would you like to use? default: prod " prodfilename
if [ -z "$prodfilename" ]; then
prodfilename="prod"
fi
read -p "Enter the list of Site names (space separated) " site
mridir=`pwd`
#####################################################################################
#############################Create directories######################################
#####################################################################################
echo "Creating the data directories"
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/"
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/trashbin" #holds mincs that didn't match protocol
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/tarchive" #holds tared dicom-folder
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/pic" #holds jpegs generated for the MRI-browser
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/logs" #holds logs from pipeline script
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/jiv" #holds JIVs used for JIV viewer
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/assembly" #holds the MINC files
sudo -S su $USER -c "mkdir -p /data/$PROJ/data/batch_output" #contains the result of the SGE (queue
sudo -S su $USER -c "mkdir -p $mridir/dicom-archive/.loris_mri"
echo
#####################################################################################
###############incoming directory using sites########################################
#####################################################################################
sudo -S su $USER -c "mkdir -p /data/incoming/";
echo "Creating incoming director(y/ies)"
for s in $site; do
sudo -S su $USER -c "mkdir -p /data/incoming/$s/incoming";
done;
echo
###################################################################################
#######set environment variables under .bashrc#####################################
###################################################################################
echo "Modifying environment script"
sed -i "s#%PROJECT%#$PROJ#g" $mridir/environment
#Make sure that CIVET stuff are placed in the right place
#source /data/$PROJ/bin/$mridirname/environment
export TMPDIR=/tmp
echo
####################################################################################
######################change permissions ###########################################
####################################################################################
#echo "Changing permissions"
sudo chmod -R 750 $mridir/.loris_mri/
sudo chmod -R 750 /data/$PROJ/
sudo chmod -R 750 /data/incoming/
echo
#####################################################################################
##########################change the prod file#######################################
#####################################################################################
echo "Creating MRI config file"
cp $mridir/dicom-archive/profileTemplate $mridir/dicom-archive/.loris_mri/$prodfilename
sudo chmod 640 $mridir/dicom-archive/.loris_mri/$prodfilename
sed -e "s#project#$PROJ#g" -e "s#/PATH/TO/DATA/location#/data/$PROJ/data#g" -e "s#yourname\\\@example.com#$email#g" -e "s#/PATH/TO/get_dicom_info.pl#$mridir/dicom-archive/get_dicom_info.pl#g" -e "s#DBNAME#$mysqldb#g" -e "s#DBUSER#$mysqluser#g" -e "s#DBPASS#$mysqlpass#g" -e "s#DBHOST#$mysqlhost#g" -e "s#/PATH/TO/dicomlib/#/data/$PROJ/data/tarchive#g" $mridir/dicom-archive/profileTemplate > $mridir/dicom-archive/.loris_mri/$prodfilename
echo "config file is located at $mridir/dicom-archive/.loris_mri/$prodfilename"
echo