-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
51 lines (47 loc) · 1.6 KB
/
install.py
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
#!/usr/python
import subprocess
install_packages = '''
if [ "$(uname)" == "Darwin" ]; then
brew update
brew list openssl || brew install openssl
brew list xctool || brew install xctool
brew list pkg-config || brew install pkg-config
brew list cmake || brew install cmake
else
if command -v apt-get >/dev/null; then
apt-get install -y software-properties-common
apt-get update
apt-get install -y cmake git build-essential libssl-dev
elif command -v yum >/dev/null; then
yum install -y python3 gcc make git cmake gcc-c++ openssl-devel
else
echo "System not supported yet!"
fi
fi
'''
install_template = '''
git clone https://github.com/emp-toolkit/X.git --branch Y
cd X
cmake .
make -j4
make install
cd ..
'''
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-install', '--install', action='store_true')
parser.add_argument('-deps', '--deps', action='store_true')
parser.add_argument('--tool', nargs='?', const='master')
parser.add_argument('--ot', nargs='?', const='master')
parser.add_argument('--sh2pc', nargs='?', const='master')
parser.add_argument('--ag2pc', nargs='?', const='master')
parser.add_argument('--agmpc', nargs='?', const='master')
parser.add_argument('--zk', nargs='?', const='master')
args = parser.parse_args()
if vars(args)['install'] or vars(args)['deps']:
subprocess.call(["bash", "-c", install_packages])
for k in ['tool', 'ot', 'zk', 'sh2pc', 'ag2pc', 'agmpc']:
if vars(args)[k]:
template = install_template.replace("X", "emp-"+k).replace("Y", vars(args)[k])
print(template)
subprocess.call(["bash", "-c", template])