-
Notifications
You must be signed in to change notification settings - Fork 36
/
biastee-enable.sh
executable file
·56 lines (47 loc) · 1.33 KB
/
biastee-enable.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
#!/bin/bash
umask 022
renice 10 $$
set -e
function aptInstall() {
if ! apt install -y --no-install-recommends --no-install-suggests "$@"; then
apt update
apt install -y --no-install-recommends --no-install-suggests "$@"
fi
}
aptInstall make cmake git build-essential libusb-1.0-0-dev librtlsdr-dev
ipath=/usr/local/share/adsb-wiki/biastee
APPS="dump1090-fa readsb"
rm -rf $ipath
mkdir -p $ipath
cd $ipath
git clone --depth 1 https://github.com/rtlsdrblog/rtl_biast
cd rtl_biast
pushd .
mkdir build
cd build
cmake .. -DDETACH_KERNEL_DRIVER=ON
make
popd
for APP in $APPS; do
if systemctl show $APP 2>/dev/null | grep -qs 'UnitFileState=enabled'; then
echo stopping $APP
systemctl stop $APP || true
fi
done
for APP in $APPS; do
mkdir -p /etc/systemd/system/$APP.service.d
cat > /etc/systemd/system/$APP.service.d/bias-t.conf << "EOF"
[Service]
ExecStartPre=/usr/local/share/adsb-wiki/biastee/rtl_biast/build/src/rtl_biast -b 1
ExecStopPost=/usr/local/share/adsb-wiki/biastee/rtl_biast/build/src/rtl_biast -b 0
EOF
done
systemctl daemon-reload
for APP in $APPS; do
if systemctl show $APP 2>/dev/null | grep -qs 'UnitFileState=enabled'; then
echo biastee will be enabled on $APP start
echo restarting $APP
systemctl restart $APP || true
fi
done
echo ----- all done ------