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.
		
		
		
		
		
			
		
			
				
					108 lines
				
				3.1 KiB
			
		
		
			
		
	
	
					108 lines
				
				3.1 KiB
			| 
								 
											2 years ago
										 
									 | 
							
								#!/bin/bash
							 | 
						||
| 
								 | 
							
								# info: list dovecot config parameters
							 | 
						||
| 
								 | 
							
								# options: [FORMAT]
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# example: v-list-sys-dovecot-config
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# This function for obtaining the list of dovecot 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'",
							 | 
						||
| 
								 | 
							
								        "config_path1": "'$config_path1'",
							 | 
						||
| 
								 | 
							
								        "config_path2": "'$config_path2'",
							 | 
						||
| 
								 | 
							
								        "config_path3": "'$config_path3'",
							 | 
						||
| 
								 | 
							
								        "config_path4": "'$config_path4'",
							 | 
						||
| 
								 | 
							
								        "config_path5": "'$config_path5'",
							 | 
						||
| 
								 | 
							
								        "config_path6": "'$config_path6'",
							 | 
						||
| 
								 | 
							
								        "config_path7": "'$config_path7'",
							 | 
						||
| 
								 | 
							
								        "config_path8": "'$config_path8'"
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								}'
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# SHELL list function
							 | 
						||
| 
								 | 
							
								shell_list() {
							 | 
						||
| 
								 | 
							
									echo "config_path:    $config_path"
							 | 
						||
| 
								 | 
							
									echo "config_path1:   $config_path1"
							 | 
						||
| 
								 | 
							
									echo "config_path2:   $config_path2"
							 | 
						||
| 
								 | 
							
									echo "config_path3:   $config_path3"
							 | 
						||
| 
								 | 
							
									echo "config_path4:   $config_path4"
							 | 
						||
| 
								 | 
							
									echo "config_path5:   $config_path5"
							 | 
						||
| 
								 | 
							
									echo "config_path6:   $config_path6"
							 | 
						||
| 
								 | 
							
									echo "config_path7:   $config_path7"
							 | 
						||
| 
								 | 
							
									echo "config_path8:   $config_path8"
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# PLAIN list function
							 | 
						||
| 
								 | 
							
								plain_list() {
							 | 
						||
| 
								 | 
							
									echo -en "$config_path\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path1\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path2\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path3\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path4\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path5\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path6\t"
							 | 
						||
| 
								 | 
							
									echo -en "$config_path7\t"
							 | 
						||
| 
								 | 
							
									echo -e "$config_path8\t"
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# CSV list function
							 | 
						||
| 
								 | 
							
								csv_list() {
							 | 
						||
| 
								 | 
							
									echo -n "config_path,config_path1,config_path2,config_path3,"
							 | 
						||
| 
								 | 
							
									echo "config_path4,config_path5,config_path6,config_path7,config_path8"
							 | 
						||
| 
								 | 
							
									echo -n "$config_path,$config_path1,$config_path2,$config_path3,"
							 | 
						||
| 
								 | 
							
									echo -n "$config_path4,$config_path5,$config_path6,$config_path7,"
							 | 
						||
| 
								 | 
							
									echo "$config_path8"
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#----------------------------------------------------------#
							 | 
						||
| 
								 | 
							
								#                       Action                             #
							 | 
						||
| 
								 | 
							
								#----------------------------------------------------------#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Defining config path
							 | 
						||
| 
								 | 
							
								if [ -e '/etc/dovecot.conf' ]; then
							 | 
						||
| 
								 | 
							
									config_path='/etc/dovecot.conf'
							 | 
						||
| 
								 | 
							
								else
							 | 
						||
| 
								 | 
							
									config_path='/etc/dovecot/dovecot.conf'
							 | 
						||
| 
								 | 
							
									config_path1='/etc/dovecot/conf.d/10-auth.conf'
							 | 
						||
| 
								 | 
							
									config_path2='/etc/dovecot/conf.d/10-logging.conf'
							 | 
						||
| 
								 | 
							
									config_path3='/etc/dovecot/conf.d/10-mail.conf'
							 | 
						||
| 
								 | 
							
									config_path4='/etc/dovecot/conf.d/10-master.conf'
							 | 
						||
| 
								 | 
							
									config_path5='/etc/dovecot/conf.d/10-ssl.conf'
							 | 
						||
| 
								 | 
							
									config_path6='/etc/dovecot/conf.d/20-imap.conf'
							 | 
						||
| 
								 | 
							
									config_path7='/etc/dovecot/conf.d/20-pop3.conf'
							 | 
						||
| 
								 | 
							
									config_path8='/etc/dovecot/conf.d/auth-passwdfile.conf.ext'
							 | 
						||
| 
								 | 
							
								fi
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Listing data
							 | 
						||
| 
								 | 
							
								case $format in
							 | 
						||
| 
								 | 
							
									json) json_list ;;
							 | 
						||
| 
								 | 
							
									plain) plain_list ;;
							 | 
						||
| 
								 | 
							
									csv) csv_list ;;
							 | 
						||
| 
								 | 
							
									shell) shell_list ;;
							 | 
						||
| 
								 | 
							
								esac
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#----------------------------------------------------------#
							 | 
						||
| 
								 | 
							
								#                       Hestia                             #
							 | 
						||
| 
								 | 
							
								#----------------------------------------------------------#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								exit
							 |