Implement distro dependent dependencies installation

This commit is contained in:
Late Night Defender 2024-05-15 13:38:54 +07:00
parent b8c538d550
commit 1e5f571e69
2 changed files with 48 additions and 45 deletions

View file

@ -12,32 +12,76 @@ func instDepsUbuntu() {
}
func instDepsDebian() {
fmt.Println("Installing dependencies on Debian")
fmt.Printf("\n\033[1;32mInstalling Python dependencies and OpenSSL from Debian repo\033[0m\n")
exec.Command("/usr/bin/apt install -y python3-pymongo python3-psutil openssl")
}
func instDepsFedora() {
fmt.Println("Installing dependencies on Fedora")
fmt.Printf("\n\033[1;32mInstalling Python dependencies and OpenSSL from Fedora repo\033[0m\n")
exec.Command("/usr/bin/dnf install -y python3-pymongo python3-psutil openssl")
}
func instDepsRedHat() {
fmt.Println("Installing dependencies on Red Hat")
fmt.Printf("\n\033[1;32mInstalling Python dependencies and OpenSSL\033[0m\n")
exec.Command("/usr/bin/dnf install -y python3-pymongo python3-psutil openssl")
}
func instDepsOpenSUSE() {
fmt.Println("Installing dependencies on openSUSE")
fmt.Printf("\n\033[1;32mInstalling Python dependencies and OpenSSL\033[0m\n")
exec.Command("/usr/bin/zypper install -y python3-pymongo python3-psutil openssl")
}
func instDockerUbuntu() {
fmt.Printf("\n\033[1;32mInstalling Docker CE 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`
exec.Command(docker_install)
}
func instDockerDebian() {
fmt.Println()
}
func instDockerFedora() {
fmt.Println()
}
func instDockerRedHat() {
fmt.Println()
}
func instDockerOpenSUSE() {
fmt.Println()
}
func instDeps() {
if getDistro() == "ubuntu" {
instDepsUbuntu()
instDockerUbuntu()
} else if getDistro() == "debian" {
instDepsDebian()
instDockerDebian()
} else if getDistro() == "fedora" {
instDepsFedora()
instDockerFedora()
} else if getDistro() == "redhat" {
instDepsRedHat()
instDockerRedHat()
} else if getDistro() == "opensuse" {
instDepsOpenSUSE()
instDockerOpenSUSE()
} else {
fmt.Println("OS not supported")
os.Exit(3)

View file

@ -1,41 +0,0 @@
package main
import(
"fmt"
"os/exec"
)
func Inst_docker_ubuntu() {
fmt.Printf("\n\033[1;32mInstalling Docker CE 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`
exec.Command(docker_install)
}
func Inst_docker_debian() {
fmt.Println()
}
func Inst_docker_fedora() {
fmt.Println()
}
func Inst_docker_redhat() {
fmt.Println()
}
func Inst_docker_opensuse() {
fmt.Println()
}