@@ -11,178 +11,3 @@ cd /tmp
1111curl -1sLf ' https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | sudo -E bash
1212bash -c " $( curl -L https://setup.vector.dev) "
1313apt-get -y install vector
14-
15- # install tar1090
16- if [[ -z " $NO_TAR1090 " ]] ; then
17- wget -O tar1090-install.sh https://raw.githubusercontent.com/wiedehopf/tar1090/master/install.sh
18- bash tar1090-install.sh /run/readsb
19- fi
20-
21- # install graphs1090
22- repo=" https://github.com/wiedehopf/graphs1090"
23- ipath=/usr/share/graphs1090
24-
25- mkdir -p /usr/share/graphs1090/installed
26- mkdir -p /var/lib/graphs1090/scatter
27-
28- apt install --no-install-recommends --no-install-suggests -y \
29- git rrdtool wget unzip bash-builtins collectd-core libpython3.9 jq
30- cd /tmp
31- wget --timeout=30 -q -O /tmp/master.zip https://github.com/wiedehopf/graphs1090/archive/master.zip
32- unzip -q -o master.zip
33- cd /tmp/graphs1090-master
34-
35- mkdir -p /var/lib/collectd/rrd/localhost/dump1090-localhost
36-
37- cp dump1090.db dump1090.py system_stats.py LICENSE /usr/share/graphs1090
38- cp * .sh /usr/share/graphs1090
39- cp malarky.conf /usr/share/graphs1090
40- chmod u+x /usr/share/graphs1090/* .sh
41- cp /etc/collectd/collectd.conf /etc/collectd/collectd.conf.graphs1090 & > /dev/null || true
42- cp collectd.conf /etc/collectd/collectd.conf
43-
44- sed -i -e ' s/RRATimespan 96048000/\0\nRRATimespan 576288000/' /etc/collectd/collectd.conf
45- sed -i -e ' s/XFF.*/XFF 0.8/' /etc/collectd/collectd.conf
46- sed -i -e ' s/skyview978/skyaware978/' /etc/collectd/collectd.conf
47-
48- # unlisted interfaces
49- for path in /sys/class/net/*
50- do
51- iface=$( basename $path )
52- # no action on existing interfaces
53- fgrep -q ' Interface "' $iface ' "' /etc/collectd/collectd.conf && continue
54- # only add interface starting with et en and wl
55- case $iface in
56- et* |en* |wl* )
57- sed -i -e ' /<Plugin "interface">/{a\
58- Interface "' $iface ' "
59- }' /etc/collectd/collectd.conf
60- ;;
61- esac
62- done
63-
64- rm -f /etc/cron.d/cron-graphs1090
65- cp -r html /usr/share/graphs1090
66- cp default /etc/default/graphs1090
67- cp default /usr/share/graphs1090/default-config
68- cp collectd.conf /usr/share/graphs1090/default-collectd.conf
69- cp service.service /lib/systemd/system/graphs1090.service
70- cp nginx-graphs1090.conf /usr/share/graphs1090
71-
72- echo " ------------------"
73- echo " TEST 1"
74- echo " ------------------"
75-
76- if [ -d /etc/lighttpd/conf.d/ ] && ! [ -d /etc/lighttpd/conf-enabled/ ] && ! [ -d /etc/lighttpd/conf-available ] && command -v lighttpd & > /dev/null
77- then
78- ln -snf /etc/lighttpd/conf.d /etc/lighttpd/conf-enabled
79- mkdir -p /etc/lighttpd/conf-available
80- fi
81- if [ -d /etc/lighttpd/conf-enabled/ ] && [ -d /etc/lighttpd/conf-available ] && command -v lighttpd & > /dev/null
82- then
83- lighttpd=yes
84- fi
85-
86- echo " ------------------"
87- echo " TEST 2"
88- echo " ------------------"
89-
90- if [[ $lighttpd == yes ]]; then
91- cp 88-graphs1090.conf /etc/lighttpd/conf-available
92- ln -snf /etc/lighttpd/conf-available/88-graphs1090.conf /etc/lighttpd/conf-enabled/88-graphs1090.conf
93-
94- cp 95-graphs1090-otherport.conf /etc/lighttpd/conf-available
95- ln -snf /etc/lighttpd/conf-available/95-graphs1090-otherport.conf /etc/lighttpd/conf-enabled/95-graphs1090-otherport.conf
96-
97- if ! grep -qs -E -e ' ^[^#]*"mod_alias"' /etc/lighttpd/lighttpd.conf /etc/lighttp/conf-enabled/* /etc/lighttpd/external.conf; then
98- echo ' server.modules += ( "mod_alias" )' > /etc/lighttpd/conf-available/07-mod_alias.conf
99- ln -s -f /etc/lighttpd/conf-available/07-mod_alias.conf /etc/lighttpd/conf-enabled/07-mod_alias.conf
100- else
101- rm -f /etc/lighttpd/conf-enabled/07-mod_alias.conf
102- fi
103- fi
104-
105- echo " ------------------"
106- echo " TEST 3"
107- echo " ------------------"
108-
109- SYM=/usr/share/graphs1090/data-symlink
110- mkdir -p $SYM
111- if [ -f /run/dump1090-fa/stats.json ]; then
112- ln -snf /run/dump1090-fa $SYM /data
113- sed -i -e ' s?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf
114- elif [ -f /run/readsb/stats.json ]; then
115- ln -snf /run/readsb $SYM /data
116- sed -i -e ' s?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf
117- elif [ -f /run/adsbexchange-feed/stats.json ]; then
118- ln -snf /run/adsbexchange-feed $SYM /data
119- sed -i -e ' s?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf
120- elif [ -f /run/dump1090/stats.json ]; then
121- ln -snf /run/dump1090 $SYM /data
122- sed -i -e ' s?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf
123- elif [ -f /run/dump1090-mutability/stats.json ]; then
124- ln -snf /run/dump1090-mutability $SYM /data
125- sed -i -e ' s?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf
126- else
127- ln -snf /run/readsb $SYM /data
128- sed -i -e ' s?URL .*?URL "file:///usr/share/graphs1090/data-symlink"?' /etc/collectd/collectd.conf
129- fi
130-
131- echo " ------------------"
132- echo " TEST 4"
133- echo " ------------------"
134-
135- SYM=/usr/share/graphs1090/978-symlink
136- mkdir -p $SYM
137- if [ -f /run/skyaware978/aircraft.json ]; then
138- ln -snf /run/skyaware978 $SYM /data
139- sed -i -e ' s?.*URL_978 .*?URL_978 "file:///usr/share/graphs1090/978-symlink"?' /etc/collectd/collectd.conf
140- elif [ -f /run/adsbexchange-978/aircraft.json ]; then
141- ln -snf /run/adsbexchange-978 $SYM /data
142- sed -i -e ' s?.*URL_978 .*?URL_978 "file:///usr/share/graphs1090/978-symlink"?' /etc/collectd/collectd.conf
143- else
144- sed -i -e ' s?.*URL_978 .*?#URL_978 "http://localhost/skyaware978"?' /etc/collectd/collectd.conf
145- fi
146-
147- echo " ------------------"
148- echo " TEST 5"
149- echo " ------------------"
150-
151- echo " ------------------"
152- echo " TEST 6"
153- echo " ------------------"
154-
155- echo " ------------------"
156- echo " TEST 7"
157- echo " ------------------"
158-
159- if ! systemctl status collectd & > /dev/null; then
160- echo --------------
161- echo " collectd isn't working, trying to install various libpython versions to work around the issue."
162- echo --------------
163- apt update
164- apt-get install --no-install-suggests --no-install-recommends -y ' libpython2.7' || true
165- apt-get install --no-install-suggests --no-install-recommends -y ' libpython3.9' || \
166- apt-get install --no-install-suggests --no-install-recommends -y ' libpython3.8' || \
167- apt-get install --no-install-suggests --no-install-recommends -y ' libpython3.7' || true
168-
169- systemctl restart collectd || true
170- if ! systemctl status collectd & > /dev/null; then
171- echo --------------
172- echo " Showing the log for collectd using this command: journalctl --no-pager -u collectd | tail -n40"
173- echo --------------
174- journalctl --no-pager -u collectd | tail -n40
175- echo --------------
176- echo " collectd still isn't working, you can try and rerun the install script at some other time."
177- echo " Or report this issue with the full 40 lines above."
178- echo --------------
179- fi
180- fi
181-
182- echo " ------------------"
183- echo " TEST 8"
184- echo " ------------------"
185-
186- if ! [[ -f /usr/share/graphs1090/noMalarky ]]; then
187- bash $ipath /malarky.sh
188- fi
0 commit comments