forked from lanxbrad/sec-fw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·160 lines (122 loc) · 2.52 KB
/
build.sh
File metadata and controls
executable file
·160 lines (122 loc) · 2.52 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#/bin/sh
PROG_SECD="secd-linux_64"
PROG_CLI="bin/cli"
PROG_SRV="bin/srv"
action=$1
argc=$#
clean_up()
{
echo "clean_up"
rm -rf sec-fw.tar.gz
rm -rf secd-linux_64
rm -rf ./bin
rm -rf ./obj-linux_64-octeon3
cd ./mgrplane
rm src/client/cparser_tree.c
rm src/client/cparser_tree.h
make clean
exit
}
build_dataplane(){
echo "---------------------------------------------------"
echo "+ +"
echo "+ Sec Fw Dataplane +"
echo "+ +"
echo "---------------------------------------------------"
rm -f $PROG_SECD
make OCTEON_TARGET=linux_64
if [ $? -eq 0 ]; then
echo "Dataplane build done!"
else
echo "Error! Dataplane build failed!"
exit
fi
if [ ! -f "$PROG_SECD" ]; then
echo "$PROG_SECD not exist"
exit
fi
cp $PROG_SECD bin/
echo "Dataplane build success....."
}
build_mgrplane(){
echo "---------------------------------------------------"
echo "+ +"
echo "+ Sec Fw Mgrplane +"
echo "+ +"
echo "---------------------------------------------------"
cd ./mgrplane
rm -rf bin
pwd
make
if [ $? -eq 0 ]; then
echo "Mgrplane build done!"
else
echo "Error! Mgrplane build failed!"
fi
if [ ! -f "$PROG_CLI" ]; then
echo "$PROG_CLI not exist"
exit
fi
if [ ! -f "$PROG_SRV" ]; then
echo "$PROG_SRV not exist"
exit
fi
cp $PROG_CLI ../bin/
cp $PROG_SRV ../bin/
echo "Mgrplane build success....."
cd ..
}
build_all(){
echo "build_all"
build_dataplane
build_mgrplane
}
prog_build_check(){
if [ ! -f "bin/secd-linux_64" ]; then
echo "bin/secd-linux_64 not exist"
exit
else
echo "bin/secd-linux_64 ok!"
fi
if [ ! -f "bin/cli" ]; then
echo "bin/cli not exist"
exit
else
echo "bin/cli ok!"
fi
if [ ! -f "bin/srv" ]; then
echo "bin/srv not exist"
exit
else
echo "bin/srv ok!"
fi
}
build_start(){
if [ ! -d bin ]; then
mkdir bin
fi
if [ $argc -gt 0 ]; then
if [ $action = "clean" ]; then
clean_up
elif [ $action = 'dataplane' ]; then
build_dataplane
elif [ $action = 'mgrplane' ]; then
build_mgrplane
fi
else
build_all
fi
}
make_package(){
cp version/scripts/startup.sh bin/
cp version/scripts/netstat_monitor.sh bin/
tar czf sec-fw.tar.gz bin
if [ $? -eq 0 ]; then
echo "Package make ok!"
else
echo "Error! Package make failed!"
fi
}
build_start
prog_build_check
make_package