package main import( "fmt" "os" ) func instDepsUbuntu() { fmt.Printf("\033[1;32mInstalling OpenSSL from Ubuntu repo\033[0m\n") ExecSystem("/usr/bin/apt update") ExecSystem("/usr/bin/apt install -y openssl") } func instDepsDebian() { fmt.Printf("\033[1;32mInstalling OpenSSL from Debian repo\033[0m\n") ExecSystem("/usr/bin/apt update") ExecSystem("/usr/bin/apt install -y openssl") } func instDepsFedora() { fmt.Printf("\033[1;32mInstalling OpenSSL from Fedora repo\033[0m\n") ExecSystem("/usr/bin/dnf install -y openssl") } func instDepsCentOS() { fmt.Printf("\033[1;32mInstalling OpenSSL from CentOS repo\033[0m\n") ExecSystem("/usr/bin/dnf install -y openssl") } func instDockerUbuntu() { fmt.Printf("\033[1;32mInstalling Docker Engine from official repo\033[0m\n") docker_install := ` apt update install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc chmod a+r /etc/apt/keyrings/docker.asc echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null apt update apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable --now docker` ExecSystem(docker_install) } func instDockerDebian() { fmt.Printf("\033[1;32mInstalling Docker Engine from official repo\033[0m\n") docker_install := ` apt update apt install ca-certificates curl install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc chmod a+r /etc/apt/keyrings/docker.asc echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null apt-get update apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable --now docker` ExecSystem(docker_install) } func instDockerFedora() { fmt.Printf("\033[1;32mInstalling Docker Engine from official repo\033[0m\n") docker_install := ` dnf -y install dnf-plugins-core dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable --now docker` ExecSystem(docker_install) } func instDockerCentOS() { fmt.Printf("\033[1;32mInstalling Docker Engine from official repo\033[0m\n") docker_install := ` yum install -y yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable --now docker` ExecSystem(docker_install) } func instDeps() { if getDistro() == "ubuntu" { instDepsUbuntu() instDockerUbuntu() } else if getDistro() == "debian" { instDepsDebian() instDockerDebian() } else if getDistro() == "fedora" { instDepsFedora() instDockerFedora() } else if getDistro() == "centos" { instDepsCentOS() instDockerCentOS() } else { fmt.Println("OS not supported") os.Exit(3) } }