refactor: change order of pre-requisites checks

This commit is contained in:
Stephan Lüscher 2024-04-30 08:51:39 +00:00
parent 4698b47ed3
commit 8a8b396e8d
No known key found for this signature in database
GPG key ID: 445779060FF3D3CF

View file

@ -91,17 +91,6 @@ function create_network {
} }
function check_prerequisites { function check_prerequisites {
echo -e "${YELLOW}Checking sshd service${ENDCOLOR}"
SSH_SERVICE_STATUS="$(systemctl is-active sshd)"
if [ "${SSH_SERVICE_STATUS}" = "inactive" ];
then
echo -e "${RED}It looks like your sshd service is not running.${ENDCOLOR}"
echo -e "${RED}Make sure to configure and start it first.${ENDCOLOR}"
exit 1
else
echo -e "${GREEN}sshd service is ${SSH_SERVICE_STATUS}${ENDCOLOR}"
echo ""
fi
echo -e "${YELLOW}Checking podman installation${ENDCOLOR}" echo -e "${YELLOW}Checking podman installation${ENDCOLOR}"
PODMAN_PATH=$(which podman 2>/dev/null || echo 'FALSE') PODMAN_PATH=$(which podman 2>/dev/null || echo 'FALSE')
if [ "$PODMAN_PATH" == "FALSE" ]; if [ "$PODMAN_PATH" == "FALSE" ];
@ -149,6 +138,18 @@ function check_prerequisites {
echo -e "${GREEN}jq is installed${ENDCOLOR}" echo -e "${GREEN}jq is installed${ENDCOLOR}"
echo "" echo ""
fi fi
echo -e "${YELLOW}Checking sshd service${ENDCOLOR}"
SSH_SERVICE_STATUS="$(systemctl is-active sshd)"
if [ "${SSH_SERVICE_STATUS}" != "active" ];
then
echo -e "${RED}It looks like your sshd service is not running.${ENDCOLOR}"
echo -e "${RED}Make sure to configure and start it first.${ENDCOLOR}"
echo -e "${YELLOW}Need help? -> https://docs.fedoraproject.org/en-US/fedora/latest/system-administrators-guide/infrastructure-services/OpenSSH/#s2-ssh-configuration-sshd${ENDCOLOR}"
exit 1
else
echo -e "${GREEN}sshd service is ${SSH_SERVICE_STATUS}${ENDCOLOR}"
echo ""
fi
} }
function show_info { function show_info {