88 lines
No EOL
2 KiB
Go
88 lines
No EOL
2 KiB
Go
package main
|
|
|
|
import(
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func instDepsUbuntu() {
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL from Ubuntu repo\033[0m\n")
|
|
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 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 instDepsRedHat() {
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL\033[0m\n")
|
|
ExecSystem("/usr/bin/dnf install -y openssl")
|
|
}
|
|
|
|
func instDepsOpenSUSE() {
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL\033[0m\n")
|
|
ExecSystem("/usr/bin/zypper install -y openssl")
|
|
}
|
|
|
|
func instDockerUbuntu() {
|
|
fmt.Printf("\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`
|
|
|
|
ExecSystem(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)
|
|
}
|
|
} |