You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.3 KiB

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