#!/bin/bash

. ${TOOLKIT}-functions.sh

module="cli-zabbix"

# v5 vs v6 compatibility
#
etcdir="/etc/zabbix"
dir="zabbix_agentd.d"
dir5="zabbix_agentd.conf.d"

cd "$etcdir"

# dir5 exists? must be moved to v6 directory
#
[ -d "$dir5" ] && {
	rmdir "$dir5" 2>/dev/null || {
		# is not empty, move thigs to v6 dir
		echo "  $module: move $dir5 files to $dir"
		cd "$dir5"
		mv * "$etcdir/$dir"/
		cd "$etcdir"
	}
}

$SOMETHING_CHANGED && {
	restart_service zabbix-agent zabbix_agentd
}

exit 0
