2
0

luci.squid 699 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # Reference: https://openwrt.org/docs/techref/rpcd
  3. . /usr/share/libubox/jshn.sh
  4. get_compile_time_options() {
  5. # Extract all options that begins with '--' as a comma-separated string
  6. source="$(squid -v)"
  7. options="$(echo $source | grep -o "'--[^']*'" | sed "s/'//g")"
  8. json_init
  9. json_add_array 'options'
  10. # For each option, add it to the array
  11. set -- $options
  12. for option; do
  13. json_add_string '' "$option"
  14. done
  15. json_close_array
  16. json_dump
  17. json_cleanup
  18. }
  19. case "$1" in
  20. list)
  21. json_init
  22. json_add_object 'getCompileTimeOptions'
  23. json_close_object
  24. json_dump
  25. json_cleanup
  26. ;;
  27. call)
  28. case "$2" in
  29. getCompileTimeOptions)
  30. get_compile_time_options
  31. ;;
  32. esac
  33. ;;
  34. esac