-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.sh
executable file
·58 lines (44 loc) · 1.45 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
#!/bin/bash
# Stop on any error
set -e
git pull
echo building service
make
echo "if you want to test the service, stop here and run under valgrind"
echo " G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --suppressions=/usr/share/glib-2.0/valgrind/glib.supp --leak-check=full --track-origins=yes ./scan"
chmod a+x ./scan
# Create executable directory
if [ ! -e /opt/sniffer ]
then
sudo mkdir /opt/sniffer
fi
# Create working directory
if [ ! -e /var/sniffer ]
then
sudo mkdir /var/sniffer
fi
if [ -e /etc/systemd/system/pi-sniffer.service ]
then
echo stopping service
sudo systemctl stop pi-sniffer.service
fi
# copy executable over to opt directory
echo Copy scan to /opt/sniffer
sudo cp scan /opt/sniffer/
# run immediately
# sudo ./scan
# update running service
echo installing service
# DBUS configuration necessary to allow name to be registered on bus
sudo cp com.signswift.sniffer.conf /etc/dbus-1/system.d/
sudo cp pi-sniffer.service /etc/systemd/system/
sudo chmod 644 /etc/systemd/system/pi-sniffer.service
sudo systemctl enable pi-sniffer.service
sudo systemctl daemon-reload
sudo systemctl enable pi-sniffer.service
echo starting service
sudo systemctl start pi-sniffer.service
echo now tailing log, ctrl-c to stop but leave service running
echo log level use -p 6 for info level, -p 7 for debug level or remove it
# Start two minutes back to see the transition and tail forward
sudo journalctl -u pi-sniffer.service -S -2min -f -p 7