-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.sh
executable file
·55 lines (42 loc) · 1.51 KB
/
setup.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
#!/bin/bash
if [ "$1" == "install" ]; then
echo "Build Started with Bazel ..."
echo "Building Emulator library ..."
bazel build :pc_emulator_lib
echo "Building Python Proto libs ..."
bazel build :py_access_service_proto
echo "Building LibModbus extensions ..."
cd contrib/libmodbus && ./autogen.sh && ./configure && make install
cd ../../
sudo ldconfig
echo "Building GRPC extensions ..."
bazel build :grpc_ext_lib
echo "Building GRPC server ..."
bazel build :pc_grpc_server
sudo cp bazel-bin/pc_grpc_server /usr/bin
echo "Building Modbus comm module ..."
bazel build :modbus_comm_module
sudo cp bazel-bin/modbus_comm_module /usr/bin
echo "Building PLC Runnable ..."
bazel build :plc_runner
sudo cp bazel-bin/plc_runner /usr/bin
echo "Building Example HMI ..."
bazel build :example_hmi
sudo cp bazel-bin/example_hmi /usr/bin
sudo cp bazel-genfiles/py_access_service_proto_pb/src/pc_emulator/proto/*.py src/pc_emulator/proto
sudo chmod 777 src/pc_emulator/proto/*.py
echo "Build and Install finished ..."
else
if [ "$1" == "uninstall" ]; then
echo "Cleaning up installation ..."
bazel clean
rm /usr/bin/pc_grpc_server || true
rm /usr/bin/modbus_comm_module || true
rm /usr/bin/plc_runner || true
rm /usr/bin/example_hmi || true
rm src/pc_emulator/proto/*.py
cd contrib/libmodbus && make uninstall
cd ../../
echo "Cleanup finished ..."
fi
fi