v-list-sys-clamd-config 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. # info: list clamd config parameters
  3. # options: [FORMAT]
  4. #
  5. # The function for obtaining the list of clamd config parameters.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. format=${1-shell}
  11. # Includes
  12. source $VESTA/func/main.sh
  13. # JSON list function
  14. json_list() {
  15. echo '{
  16. "CONFIG": {
  17. "config_path": "'$config_path'"
  18. }
  19. }'
  20. }
  21. # SHELL list function
  22. shell_list() {
  23. echo "config_path: $config_path"
  24. }
  25. # PLAIN list function
  26. plain_list() {
  27. echo "$config_path"
  28. }
  29. # CSV list function
  30. csv_list() {
  31. echo "config_path"
  32. echo "$config_path"
  33. }
  34. #----------------------------------------------------------#
  35. # Action #
  36. #----------------------------------------------------------#
  37. # Defining config path
  38. if [ -e '/etc/clamav/clamd.conf' ]; then
  39. config_path='/etc/clamav/clamd.conf'
  40. else
  41. if [ -e '/etc/clamd.conf' ]; then
  42. config_path='/etc/clamd.conf'
  43. fi
  44. if [ -e '/etc/clamd.d/clamd.conf' ]; then
  45. config_path='/etc/clamav/clamd.conf'
  46. fi
  47. fi
  48. # Listing data
  49. case $format in
  50. json) json_list ;;
  51. plain) plain_list ;;
  52. csv) csv_list ;;
  53. shell) shell_list;;
  54. esac
  55. #----------------------------------------------------------#
  56. # Vesta #
  57. #----------------------------------------------------------#
  58. exit