-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
89 lines (82 loc) · 2.81 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
#!/usr/bin/env bash
set -e
set -x
shopt -s nullglob
#Suggests provided branch. Else suggests master
default_branch=${1-master}
default_name=${2-microSALT}
echo "Welcome to the microSALT installation script. Q to exit"
while true; do
echo "Name your microSALT environment ['microSALT']:"
read input
if [[ $input = "q" ]] || [[ $input = "Q" ]]; then
break
elif [[ $input = "y" ]] || [[ $input = "yes" ]] || [[ $input = "" ]]; then
cname=$default_name
break
else
cname=$input
break
fi
done
while true; do
echo "Would you like a 'release' or 'source' (development) environment ['release']?"
read input
if [[ $input = "q" ]] || [[ $input = "Q" ]]; then
break
elif [[ $input = "y" ]] || [[ $input = "yes" ]] || [[ $input = "" ]]; then
type="release"
break
elif [[ $input == "source" ]] || [[ $input == "release" ]]; then
type=$input
break
fi
done
validbranch=false
while true; do
echo "Name the branch to install ['$default_branch']:"
while ! $validbranch; do
read input
if [[ $input = "y" ]] || [[ $input = "yes" ]] || [[ $input = "" ]]; then
branch=$default_branch
else
branch=$input
fi
curl https://raw.githubusercontent.com/Clinical-Genomics/microSALT/$branch/LICENSE | tac | tac | grep -q 'License' && validbranch=true||echo "Invalid branch name"
done
break
done
echo "Thank you, setting up environment $cname!"
#Only use micromamba if inside GitHub Actions
if [[ -z "${GITHUB_ACTIONS}" ]]; then
conda_cmd="micromamba"
else
conda_cmd="conda"
fi
#Unload environment
$conda_cmd info | tac | tac | grep -q $cname && source deactivate || :
#Remove environment if already present
$conda_cmd remove -y -n $cname --all || :
$conda_cmd env create -n $cname -f https://raw.githubusercontent.com/Clinical-Genomics/microSALT/$branch/environment.yml
source activate $cname
if [[ $type == "release" ]]; then
pip install -r https://raw.githubusercontent.com/Clinical-Genomics/microSALT/$branch/requirements.txt -r https://raw.githubusercontent.com/Clinical-Genomics/microSALT/$branch/requirements-dev.txt
pip install -U git+https://github.com/Clinical-Genomics/microSALT@$branch
elif [[ $type == "source" ]]; then
HERE=$PWD
if [ -d ${HERE}/microSALT ]; then
rm -rf microSALT
fi
git clone https://github.com/Clinical-Genomics/microSALT
cd microSALT && git checkout $branch
pip install -r requirements.txt -r requirements-dev.txt && pip install -e . && cd ${HERE}
echo "Source installed under ${HERE}/microSALT"
fi
echo "Installation Complete!"
while true; do
echo "Configuration requires manual set-up as described in README.md ['yes']:"
read input
if [[ $input = "y" ]] || [[ $input = "yes" ]]; then
break
fi
done