-
Notifications
You must be signed in to change notification settings - Fork 10
/
checkfiles.sh
executable file
·70 lines (59 loc) · 2.1 KB
/
checkfiles.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
#!/bin/bash
#if [ ! -z "$src_dir+x" ]; then
src_dir=$PWD/src
#fi
if [ ! -f "${src_dir}/dEploid.cpp" ]; then
"Error: please execute \".checkfiles.sh\" from DEploid root directory"
exit 1
fi
OS=`uname -s`
#echo "operating system is ${OS}"
# VERSION=$(cat VERSION | tr -d '\n')
VERSION=0.1-release
echo -n "." # echo "ok not git clone, now check plot and figure"
#rm master.tar.gz # just making sure download the one we actually want to
extract_submodule_from(){
account=$1
submodule=$2
placeto=$3
echo "Extract submodule $submodule from account $account, place at $3"
if [ ! -d ${submodule}_dir ]; then mkdir ${submodule}_dir; fi
echo -n "." # echo "ok, do something" #
if [[ "${OS}" == "Linux" ]]; then
wget --no-check-certificate https://github.com/${account}/${submodule}/archive/v${VERSION}.tar.gz -o /dev/null
elif [[ "${OS}" == "Darwin"* ]]; then
curl -LOk https://github.com/${account}/${submodule}/archive/v${VERSION}.tar.gz
else
echo "Unknown OS, fail to download package from https://github.com/${account}/${submodule}/archive/v${VERSION}.tar.gz"
echo "Please contact Joe at [email protected] if assistance is needed"
exit 1
fi
ls *gz
if [ ! -f v${VERSION}.tar.gz ]; then
echo "Error: Download package from https://github.com/${account}/${submodule}/archive/v${VERSION}.tar.gz failed"
echo "Please contact Joe at [email protected] if assistance is needed"
exit 1
fi
tar -xf v${VERSION}.tar.gz -C ${submodule}_dir
if [ ! -d ${placeto} ]; then mkdir ${placeto}; fi
cp -r ${submodule}_dir/${submodule}-${VERSION}/* ${placeto}/
rm -r ${submodule}_dir v${VERSION}.tar.gz
}
ACCOUNT=DEploid-dev
SUBMODLUE=DEploid-Utilities
PLACETO=utilities
tmp_dir=$PWD/utilities
if [ -f ${tmp_dir}/DEploidR.R -a -f ${tmp_dir}/dEploidTools.r ];then
echo -n "." # echo "ok, do nothing"
else
extract_submodule_from $ACCOUNT $SUBMODLUE $PLACETO
fi
ACCOUNT=shajoezhu
SUBMODLUE=DEploid-Lasso-lib
PLACETO=$PWD/src/lasso
tmp_dir=$PWD/src/lasso
if [ -f ${tmp_dir}/main.cpp -a -f ${tmp_dir}/README.md ];then
echo -n "." # echo "ok, do nothing"
else
extract_submodule_from $ACCOUNT $SUBMODLUE $PLACETO
fi