-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbgcInstaller.sh
executable file
·113 lines (88 loc) · 4.15 KB
/
bgcInstaller.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
#!/bin/sh
##########################################################################################
# bgc_tools #
# File: bgcInstaller.sh #
VERSION="v1.0.1" #
# Author: Justin C. Bagley #
# Date: created by Justin Bagley on Wed, Oct 2 14:24:59 CDT 2019 #
# Last update: December 12, 2020 #
# Copyright (c) 2019-2020 Justin C. Bagley. All rights reserved. #
# Please report bugs to <[email protected]>. #
# #
# Description: #
# SCRIPT THAT AUTOMATES DOWNLOAD AND INSTALL OF THE SOFTWARE PROGRAM BGC (FOR BAYESIAN #
# GENOMIC CLINE ANALYSIS) ON A UNIX/LINUX MACHINE #
# #
##########################################################################################
if [[ "$1" == "-V" ]] || [[ "$1" == "--version" ]]; then
echo "$(basename "$0") $VERSION";
exit
fi
echo "
##########################################################################################
# bgcInstaller v1.0.1, December 2020 #
##########################################################################################"
######################################## START ###########################################
## OUTPUT
# exec >> ./bgc_installer_log.out.txt
# exec 2>&1
## idea for selectively logging output to file (from URL: https://stackoverflow.com/questions/18311436/start-and-stop-logging-terminal-output-to-file-from-within-bash-script):
# {
# echo "aaa"
# echo "bbb"
# echo "ccc"
# } 2>&1 | tee logfile.log
## DOWNLOAD BGC
cd ~ ;
if [[ ! -s bgcdist1.03.tar.gz ]]; then
echo "$(date) Downloading bgc v1.03 distribution (tarball) from the web... "
curl -O -J -L https://sites.google.com/site/bgcsoftware/home/bgcdist1.03.tar.gz?attredirects=0&d=1 ;
sleep 60 ;
echo ""
fi
if [[ -s ./bgcdist1.03.tar.gz ]]; then
echo "$(date) Found bgc tarball in place. Unzipping... "
tar -xzvf bgcdist1.03.tar.gz ;
cd bgcdist/ ;
echo ""
echo "$(date) Moving into bgcdist/ directory... "
echo ""
else
echo "$(date) Curl download failed. Quitting..." ;
exit 1 ;
fi
## INSTALL BGC
echo "$(date) Checking and fixing clang / clang++ ... "
MY_CLANG_PLUS_NAME="$(ls -l $(which clang)* | grep '++' | sed 's/.*\ .*\ \/.*\///g; s/\ //g')" ;
sed -i.bak 's/x86\_64\-apple\-darwin13\.4\.0\-clang++/'"$MY_CLANG_PLUS_NAME"'/g' "$(which h5c++)" ;
echo ""
MY_CLANG_NAME="$(ls -l $(which clang)* | grep -v '++' | sed 's/.*\ .*\ \/.*\///g; s/\ //g')" ;
sed -i.bak 's/x86\_64\-apple\-darwin13\.4\.0\-clang/'"$MY_CLANG_NAME"'/g' "$(which h5cc)" ;
echo ""
echo "$(date) Compiling bgc for your machine... "
# Compile bgc:
h5c++ -Wall -O2 -o bgc bgc_main.C bgc_func_readdata.C bgc_func_initialize.C bgc_func_mcmc.C bgc_func_write.C bgc_func_linkage.C bgc_func_ngs.C bgc_func_hdf5.C mvrandist.c -lgsl -lgslcblas
ls -l ./bgc* ;
echo ""
echo "$(date) Compiling estpost utility program for your machine... "
# Compile estpost utility program:
h5cc -Wall -O3 -o estpost estpost_h5.c -lgsl -lgslcblas
ls -l ./estp* ;
echo ""
echo "$(date) Finishing bgc install, with your sudo permission :) ... "
# Finish install:
chmod u+x bgc estpost ;
sudo cp bgc estpost /usr/bin/ ;
## CHECK BGC
cd ..;
echo "$(date) Checking to see whether bgc is working on your machine... "
echo "$(date) Testing... testing... 1... 2... 3... "
bgc -h ;
estpost -h ;
echo " Finished downloading and compiling bgc and related utility program estpost on your local machine using bgcInstaller (bgc_tools). "
echo " Bye."
#
#
#
######################################### END ############################################
exit 0