-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-dirs.sh
executable file
·72 lines (64 loc) · 1.97 KB
/
setup-dirs.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
#!/bin/bash
set -e
base_dir=${PWD}
versions="3.0.3 3.2.0"
src_types="vendor perturb"
rm -rf advantg-src advantg-install
mkdir -pv advantg-src advantg-install
for version in ${versions}; do
advantg_dir=/opt/software/ADVANTG-${version}
# Location of relevant source files within install directory
if [ ${version} == "3.0.3" ]; then
subdirs="python"
elif [ ${version} == "3.2.0" ]; then
subdirs="packages advantg python"
else
echo "Invalid version: ${version}"
exit 0
fi
src_dir=${advantg_dir}
for subdir in ${subdirs}; do
src_dir=${src_dir}/${subdir}
done
src_dir=${src_dir}/advantg
# Set up source directories
cd ${base_dir}/advantg-src
cp -rp ${src_dir} ${version}-vendor
cp -rp ${src_dir} ${version}-perturb
cd ${version}-perturb
patch -p1 < ${base_dir}/patch/${version}.patch
# Set up install directories
cd ${base_dir}/advantg-install
mkdir -pv ${version}-vendor
cd ${version}-vendor
src_dir=${advantg_dir}
for subdir in ${subdirs}; do
for f in $(ls ${src_dir} -I ${subdir}); do
ln -sv ${src_dir}/${f} .
done
src_dir=${src_dir}/${subdir}
mkdir -pv ${subdir}
cd ${subdir}
done
cd ${base_dir}/advantg-install
cp -rp ${version}-vendor ${version}-perturb
for src_type in ${src_types}; do
cd ${base_dir}/advantg-install
install_dir=${version}-${src_type}
for subdir in ${subdirs}; do
install_dir=${install_dir}/${subdir}
done
cd ${install_dir}
ln -sv ${base_dir}/advantg-src/${version}-${src_type} advantg
done
# Fix advantg.rc
if [ ${version} == "3.0.3" ]; then continue; fi
for src_type in ${src_types}; do
cd ${base_dir}/advantg-install/${version}-${src_type}
rm -fv advantg.rc
cp -pv ${advantg_dir}/advantg.rc .
dir1=`echo ${advantg_dir} | sed 's/\//\\\\\//g'`
dir2=`echo ${base_dir}/advantg-install/${version}-${src_type} | sed 's/\//\\\\\//g'`
sed -i "s/ADVANTG=${dir1}/ADVANTG=${dir2}/" advantg.rc
done
done