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.

92 lines
2.4 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_bind_address "--net-bind-address"
  43. append_arg "$cfg" net_http_port "--net-http-port"
  44. append_arg "$cfg" net_ri_port "--net-ri-port"
  45. append_arg "$cfg" net_ro_port "--net-ro-port"
  46. append_arg "$cfg" net_sbs_port "--net-sbs-port"
  47. append_arg "$cfg" net_bi_port "--net-bi-port"
  48. append_arg "$cfg" net_bo_port "--net-bo-port"
  49. append_arg "$cfg" net_ro_size "--net-ro-size"
  50. append_arg "$cfg" net_ro_rate "--net-ro-rate"
  51. append_arg "$cfg" net_heartbeat "--net-heartbeat"
  52. append_arg "$cfg" net_buffer "--net-buffer"
  53. append_arg "$cfg" lat "--lat"
  54. append_arg "$cfg" lon "--lon"
  55. append_bool "$cfg" fix "--fix"
  56. append_bool "$cfg" no_fix "--no-fix"
  57. append_bool "$cfg" no_crc_check "--no-crc-check"
  58. append_bool "$cfg" phase_enhance "--phase-enhance"
  59. append_bool "$cfg" agressive "--agressive"
  60. append_bool "$cfg" mlat "--mlat"
  61. append_bool "$cfg" stats "--stats"
  62. append_arg "$cfg" stats_every "--stats-every"
  63. append_bool "$cfg" onlyaddr "--onlyaddr"
  64. append_bool "$cfg" metric "--metric"
  65. append_arg "$cfg" snip "--snip"
  66. append_arg "$cfg" debug "--debug"
  67. append_arg "$cfg" ppm "--ppm"
  68. config_get_bool aux "$cfg" 'respawn' '0'
  69. [ "$aux" = 1 ] && procd_set_param respawn
  70. procd_close_instance
  71. }
  72. service_triggers() {
  73. procd_add_reload_trigger "dump1090"
  74. }
  75. start_service() {
  76. config_load dump1090
  77. config_foreach start_instance dump1090
  78. }