-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall.sh
53 lines (39 loc) · 1.25 KB
/
install.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
#!/bin/bash
FIREWALLCTL_PATH=$PWD/firewall/firewallctl.c
FIREWALL_PATH=$PWD/firewall.c
echo "Start installation for Basic-Firewall Kernel Module, Installing make and gcc..."
#apt-get update && apt-get install make gcc
echo "Looking for files..."
if [ ! -e $FIREWALL_PATH ]; then
echo "Sorry we canno't find the firewall.c file, looked at $FIREWALL_PATH"
echo "Cannot continue with the installing."
exit -1
fi
if [ ! -e $FIREWALLCTL_PATH ]; then
echo "Sorry we canno't find the firewall.c file, looked at $FIREWALL_PATH"
echo "Cannot continue with the installation."
fi
echo "Installing firewall controller, compailing firewallctl.c ...."
gcc $FIREWALLCTL_PATH -o firewallctl.o
if [ ! -e $PWD/firewallctl.o ]; then
echo "Compilation failed !"
echo "Cannot continue with the installation."
exit -1
fi
echo "Copy the firewallctl to /usr/bin\n"
mv $PWD/firewallctl.o /usr/bin/firewallctl
echo "Installing the firewall..."
make
if [ ! $? -eq 0 ]; then # Testing if make successed..
echo "Compilation failed !"
echo "Cannot continue with the installation."
exit -1
fi
insmod firewall.ko
if [ $? -eq 0 ]; then # Testing if make successed..
echo "Done."
exit 0
fi
echo "Installation failed !"
echo "Cannot continue with the installing.\n"
exit -1