-
Notifications
You must be signed in to change notification settings - Fork 72
/
build.sh
executable file
·67 lines (56 loc) · 1.47 KB
/
build.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
#!/bin/bash
ROOT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
source ./kmesh_compile_env_pre.sh
function install() {
mkdir -p /etc/kmesh
chmod 700 /etc/kmesh
cp $ROOT_DIR/build/kmesh-start-pre.sh /usr/bin
chmod 500 /usr/bin/kmesh-start-pre.sh
cp $ROOT_DIR/build/kmesh-stop-post.sh /usr/bin
chmod 500 /usr/bin/kmesh-stop-post.sh
mkdir -p /etc/oncn-mda
chmod 700 /etc/oncn-mda
cp $ROOT_DIR/oncn-mda/etc/oncn-mda.conf /etc/oncn-mda/
chmod 600 /etc/oncn-mda/oncn-mda.conf
}
function uninstall() {
rm -rf /etc/kmesh
rm -rf /usr/bin/kmesh-start-pre.sh
rm -rf /usr/bin/kmesh-stop-post.sh
rm -rf /etc/oncn-mda
rm -rf /usr/share/oncn-mda
}
function clean() {
rm -rf /etc/kmesh
rm -rf /usr/bin/kmesh-start-pre.sh
rm -rf /usr/bin/kmesh-stop-post.sh
}
set_enhanced_kernel_env
if [ "$1" == "-h" -o "$1" == "--help" ]; then
echo build.sh -h/--help : Help.
echo build.sh -b/--build: Build Kmesh.
echo build.sh -i/--install: Install Kmesh.
echo build.sh -c/--clean: Clean the built binary.
echo build.sh -u/--uninstall: Uninstall Kmesh.
exit
fi
if [ -z "$1" -o "$1" == "-b" -o "$1" == "--build" ]; then
prepare
make
exit
fi
if [ "$1" == "-i" -o "$1" == "--install" ]; then
make install
install
exit
fi
if [ "$1" == "-u" -o "$1" == "--uninstall" ]; then
make uninstall
uninstall
exit
fi
if [ "$1" == "-c" -o "$1" == "--clean" ]; then
make clean
clean
exit
fi