#!/bin/bash

if [[ -z "${WELCOME_SCRIPT_PATH}" ]]; then
  WELCOME_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)"
fi

#region INCLUDES
. "${WELCOME_SCRIPT_PATH}/config/config_colors.sh"
. "${WELCOME_SCRIPT_PATH}/config/config_services.sh"
. "${WELCOME_SCRIPT_PATH}/func/message.sh"
. "${WELCOME_SCRIPT_PATH}/func/message_display.sh"
. "${WELCOME_SCRIPT_PATH}/func/services_check.sh"
#endregion

#region COMMONS
get_systemd_status
get_fail2ban_status
get_apparmor_status
get_ufw_status
#endregion

#region DYNAMICS
for entry in "${SERVICES_TO_CHECK[@]}"; do
  IFS="|" read -r name bin <<< "$entry"
  check_service "$bin" "$name"
done
#endregion
