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.
		
		
		
		
		
			
		
			
				
					
					
						
							81 lines
						
					
					
						
							1.8 KiB
						
					
					
				
			
		
		
	
	
							81 lines
						
					
					
						
							1.8 KiB
						
					
					
				#!/bin/bash
 | 
						|
# info: list clamd config parameters
 | 
						|
# options: [FORMAT]
 | 
						|
#
 | 
						|
# example: v-list-sys-clamd-config
 | 
						|
#
 | 
						|
# This function for obtaining the list of clamd config parameters.
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                Variables & Functions                     #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
# Argument definition
 | 
						|
format=${1-shell}
 | 
						|
 | 
						|
# Includes
 | 
						|
# shellcheck source=/etc/hestiacp/hestia.conf
 | 
						|
source /etc/hestiacp/hestia.conf
 | 
						|
# shellcheck source=/usr/local/hestia/func/main.sh
 | 
						|
source $HESTIA/func/main.sh
 | 
						|
# load config file
 | 
						|
source_conf "$HESTIA/conf/hestia.conf"
 | 
						|
 | 
						|
# JSON list function
 | 
						|
json_list() {
 | 
						|
	echo '{
 | 
						|
    "CONFIG": {
 | 
						|
        "config_path": "'$config_path'"
 | 
						|
        }
 | 
						|
}'
 | 
						|
}
 | 
						|
 | 
						|
# SHELL list function
 | 
						|
shell_list() {
 | 
						|
	echo "config_path:    $config_path"
 | 
						|
}
 | 
						|
 | 
						|
# PLAIN list function
 | 
						|
plain_list() {
 | 
						|
	echo "$config_path"
 | 
						|
}
 | 
						|
 | 
						|
# CSV list function
 | 
						|
csv_list() {
 | 
						|
	echo "config_path"
 | 
						|
	echo "$config_path"
 | 
						|
}
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                       Action                             #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
# Defining config path
 | 
						|
if [ -e '/etc/clamav/clamd.conf' ]; then
 | 
						|
	config_path='/etc/clamav/clamd.conf'
 | 
						|
else
 | 
						|
	if [ -e '/etc/clamd.conf' ]; then
 | 
						|
		config_path='/etc/clamd.conf'
 | 
						|
	fi
 | 
						|
	if [ -e '/etc/clamd.d/clamd.conf' ]; then
 | 
						|
		config_path='/etc/clamd.d/clamd.conf'
 | 
						|
	fi
 | 
						|
	if [ -e '/etc/clamd.d/daemon.conf' ]; then
 | 
						|
		config_path='/etc/clamd.d/daemon.conf'
 | 
						|
	fi
 | 
						|
fi
 | 
						|
 | 
						|
# Listing data
 | 
						|
case $format in
 | 
						|
	json) json_list ;;
 | 
						|
	plain) plain_list ;;
 | 
						|
	csv) csv_list ;;
 | 
						|
	shell) shell_list ;;
 | 
						|
esac
 | 
						|
 | 
						|
#----------------------------------------------------------#
 | 
						|
#                       Hestia                             #
 | 
						|
#----------------------------------------------------------#
 | 
						|
 | 
						|
exit
 |