-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreinstall.sh
executable file
·133 lines (115 loc) · 3.47 KB
/
reinstall.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
# Only can be used when musl-libc already being built!
Curr_Path=`pwd`
echo "Current Path: "$Curr_Path
Bash_Dir=$(cd "$(dirname "$0")";pwd)
echo "Bash file Path: "$Bash_Dir
if [ "$Curr_Path" != "$Bash_Dir" ]
then
echo "Wrong install path! Please make sure you are in a right elf-respect repo!"
exit 1
fi
cd ..
Install_Path=`pwd`
echo "Re-install Path: "$Install_Path
if [ ! -d "./linux-sgx" ]
then
echo "No SGXSDK!"
exit 1
fi
SGXSDK_Source_Path=`pwd`"/linux-sgx"
if [ ! -d "./elfutils" ]
then
echo "No Libelf!"
exit 1
fi
Libelf_Path=`pwd`"/elfutils"
if [ ! -d "./capstone" ]
then
echo "No Capstone!"
exit 1
fi
Capstone_Path=`pwd`"/capstone"
if [ ! -d "./llvm-mc" ]
then
echo "No llvm-mc!"
exit 1
fi
LLVM_MC_Path=`pwd`"/llvm-mc"
if [ ! -d "./proofGen" ]
then
echo "No proofGen!"
exit 1
fi
ProofGen_Path=`pwd`"/proofGen"
# project name
cd Deflection
echo "Configuring loader..."
cd loader
echo "Generating new Makefile header..."
rm -f Makefile
echo "SGX_SRC_PATH = "$SGXSDK_Source_Path > Makefile_header4checker
echo "ELFUTILS_PATH = "$Libelf_Path >> Makefile_header4checker
echo "CAPSTONE_PATH = "$Capstone_Path >> Makefile_header4checker
cat Makefile_header4checker Makefile_template4checker > Makefile
make clean
rm Makefile_header4checker
cd target-program
echo "Generating new Makefile header..."
rm -f Makefile
CC4AS=$LLVM_MC_Path"/build/bin/clang -fPIC -fno-asynchronous-unwind-tables -fno-addrsig"
echo "CC = "$CC4AS > Makefile_header4target
cat Makefile_header4target Makefile_template4target > Makefile
rm Makefile_header4target
make clean
cd mbedtls
echo "Generating new Makefile header..."
rm -f Makefile
echo "LLVM_MC_PATH = "$LLVM_MC_Path > Makefile_header4https
cat Makefile_header4https Makefile_template4https > Makefile
rm Makefile_header4https
cd ../../..
echo "Configuring dynamic-loader-checker..."
cd dynamic-loader-checker
echo "Generating new Makefile header..."
rm -f Makefile
echo "SGX_SRC_PATH = "$SGXSDK_Source_Path > Makefile_header4checker
echo "ELFUTILS_PATH = "$Libelf_Path >> Makefile_header4checker
echo "CAPSTONE_PATH = "$Capstone_Path >> Makefile_header4checker
cat Makefile_header4checker Makefile_template4checker > Makefile
make clean
rm Makefile_header4checker
cd target-program
echo "Generating new Makefile header..."
rm -f Makefile
echo "LLVM_PATH = "$ProofGen_Path > Makefile_header4target
echo "Our_AS_Path = "$LLVM_MC_Path >> Makefile_header4target
cat Makefile_header4target Makefile_template4target > Makefile
rm Makefile_header4target
make clean
cd mbedtls
echo "Generating new Makefile header..."
rm -f Makefile
echo "LLVM_MC_PATH = "$LLVM_MC_Path > Makefile_header4https
echo "LLVM_PATH = "$ProofGen_Path >> Makefile_header4https
cat Makefile_header4https Makefile_template4https > Makefile
rm Makefile_header4https
cd ../..
cd sc-resil-tg
echo "Generating new Makefile header..."
rm -f Makefile
echo "LLVM_PATH = "$ProofGen_Path > Makefile_header4target
echo "Our_AS_Path = "$LLVM_MC_Path >> Makefile_header4target
echo "SGX_SRC_PATH = "$SGXSDK_Source_Path >> Makefile_header4target
cat Makefile_header4target Makefile_template4target > Makefile
rm Makefile_header4target
make clean
cd mbedtls
echo "Generating new Makefile header..."
rm -f Makefile
echo "LLVM_MC_PATH = "$LLVM_MC_Path > Makefile_header4https
echo "LLVM_PATH = "$ProofGen_Path >> Makefile_header4https
cat Makefile_header4https Makefile_template4https > Makefile
rm Makefile_header4https
cd ../../..
echo "Re-installed!"