|
@@ -0,0 +1,91 @@
|
|
1
|
+#!/bin/sh /etc/rc.common
|
|
2
|
+# Copyright (C) 2014 OpenWrt.org
|
|
3
|
+
|
|
4
|
+START=90
|
|
5
|
+STOP=10
|
|
6
|
+USE_PROCD=1
|
|
7
|
+
|
|
8
|
+append_arg() {
|
|
9
|
+ local cfg="$1"
|
|
10
|
+ local var="$2"
|
|
11
|
+ local opt="$3"
|
|
12
|
+ local def="$4"
|
|
13
|
+ local val
|
|
14
|
+
|
|
15
|
+ config_get val "$cfg" "$var"
|
|
16
|
+ [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
|
|
17
|
+}
|
|
18
|
+
|
|
19
|
+append_bool() {
|
|
20
|
+ local cfg="$1"
|
|
21
|
+ local var="$2"
|
|
22
|
+ local opt="$3"
|
|
23
|
+ local def="$4"
|
|
24
|
+ local val
|
|
25
|
+
|
|
26
|
+ config_get_bool val "$cfg" "$var" "$def"
|
|
27
|
+ [ "$val" = 1 ] && procd_append_param command "$opt"
|
|
28
|
+}
|
|
29
|
+
|
|
30
|
+start_instance() {
|
|
31
|
+ local cfg="$1"
|
|
32
|
+
|
|
33
|
+ config_get_bool disabled "$cfg" 'disabled' '0'
|
|
34
|
+ [ "$disabled" = 1 ] && return 1
|
|
35
|
+
|
|
36
|
+ procd_open_instance
|
|
37
|
+
|
|
38
|
+ procd_set_param command /usr/bin/dump1090
|
|
39
|
+
|
|
40
|
+ append_arg "$cfg" device_index "--device-index"
|
|
41
|
+ append_arg "$cfg" gain "--gain"
|
|
42
|
+ append_bool "$cfg" enable_agc "--enable-agc"
|
|
43
|
+ append_arg "$cfg" freq "--freq"
|
|
44
|
+ append_arg "$cfg" ifile "--ifile"
|
|
45
|
+ append_bool "$cfg" interactive "--interactive"
|
|
46
|
+ append_arg "$cfg" interactive_rows "--interactive-rows"
|
|
47
|
+ append_arg "$cfg" interactive_ttl "--interactive-ttl"
|
|
48
|
+ append_bool "$cfg" interactive_rtl1090 "--interactive-rtl1090"
|
|
49
|
+ append_bool "$cfg" raw "--raw"
|
|
50
|
+ append_bool "$cfg" net "--net"
|
|
51
|
+ append_bool "$cfg" modeac "--modeac"
|
|
52
|
+ append_bool "$cfg" net_beast "--net-beast"
|
|
53
|
+ append_bool "$cfg" net_only "--net-only"
|
|
54
|
+ append_arg "$cfg" net_http_port "--net-http-port"
|
|
55
|
+ append_arg "$cfg" net_ri_port "--net-ri-port"
|
|
56
|
+ append_arg "$cfg" net_ro_port "--net-ro-port"
|
|
57
|
+ append_arg "$cfg" net_sbs_port "--net-sbs-port"
|
|
58
|
+ append_arg "$cfg" net_bi_port "--net-bi-port"
|
|
59
|
+ append_arg "$cfg" net_bo_port "--net-bo-port"
|
|
60
|
+ append_arg "$cfg" net_ro_size "--net-ro-size"
|
|
61
|
+ append_arg "$cfg" net_ro_rate "--net-ro-rate"
|
|
62
|
+ append_arg "$cfg" net_heartbeat "--net-heartbeat"
|
|
63
|
+ append_arg "$cfg" net_buffer "--net-buffer"
|
|
64
|
+ append_arg "$cfg" lat "--lat"
|
|
65
|
+ append_arg "$cfg" lon "--lon"
|
|
66
|
+ append_bool "$cfg" fix "--fix"
|
|
67
|
+ append_bool "$cfg" no_fix "--no-fix"
|
|
68
|
+ append_bool "$cfg" no_crc_check "--no-crc-check"
|
|
69
|
+ append_bool "$cfg" phase_enhance "--phase-enhance"
|
|
70
|
+ append_bool "$cfg" agressive "--agressive"
|
|
71
|
+ append_bool "$cfg" mlat "--mlat"
|
|
72
|
+ append_bool "$cfg" stats "--stats"
|
|
73
|
+ append_arg "$cfg" stats_every "--stats-every"
|
|
74
|
+ append_bool "$cfg" onlyaddr "--onlyaddr"
|
|
75
|
+ append_bool "$cfg" metric "--metric"
|
|
76
|
+ append_arg "$cfg" snip "--snip"
|
|
77
|
+ append_arg "$cfg" debug "--debug"
|
|
78
|
+ append_bool "$cfg" quiet "--quiet"
|
|
79
|
+ append_arg "$cfg" ppm "--ppm"
|
|
80
|
+
|
|
81
|
+ procd_close_instance
|
|
82
|
+}
|
|
83
|
+
|
|
84
|
+service_triggers() {
|
|
85
|
+ procd_add_reload_trigger "dump1090"
|
|
86
|
+}
|
|
87
|
+
|
|
88
|
+start_service() {
|
|
89
|
+ config_load dump1090
|
|
90
|
+ config_foreach start_instance dump1090
|
|
91
|
+}
|