#\!/bin/bash # This module handles installing dependencies install_dependencies() { echo "Checking and installing dependencies..." # Check if we're on a Debian/Ubuntu system if command -v apt-get &> /dev/null; then install_debian_dependencies # Check if we're on a RHEL/CentOS/Fedora system elif command -v yum &> /dev/null || command -v dnf &> /dev/null; then install_rhel_dependencies else echo "Unsupported package manager. Please install dependencies manually." return 1 fi # Install .NET runtime if needed install_dotnet return 0 } install_debian_dependencies() { echo "Installing dependencies for Debian/Ubuntu..." sudo apt-get update sudo apt-get install -y wget curl jq unzip return 0 } install_rhel_dependencies() { echo "Installing dependencies for RHEL/CentOS/Fedora..." if command -v dnf &> /dev/null; then sudo dnf install -y wget curl jq unzip else sudo yum install -y wget curl jq unzip fi return 0 } install_dotnet() { echo "Checking .NET runtime..." # Check if .NET 7.0 is already installed if command -v dotnet &> /dev/null; then dotnet_version=$(dotnet --version) if [[ $dotnet_version == 7.* ]]; then echo ".NET 7.0 is already installed (version $dotnet_version)" return 0 fi fi echo "Installing .NET 7.0 runtime..." # For Debian/Ubuntu if command -v apt-get &> /dev/null; then wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb sudo apt-get update sudo apt-get install -y dotnet-runtime-7.0 # For RHEL/CentOS/Fedora elif command -v yum &> /dev/null || command -v dnf &> /dev/null; then sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm if command -v dnf &> /dev/null; then sudo dnf install -y dotnet-runtime-7.0 else sudo yum install -y dotnet-runtime-7.0 fi else echo "Unsupported system for automatic .NET installation. Please install .NET 7.0 runtime manually." return 1 fi echo ".NET 7.0 runtime installed successfully" return 0 }