2024-05-15 05:56:21 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import(
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func instDepsUbuntu() {
|
2024-05-16 07:42:38 +00:00
|
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL from Ubuntu repo\033[0m\n")
|
2024-05-17 08:39:55 +00:00
|
|
|
ExecSystem("/usr/bin/apt update")
|
2024-05-16 07:42:38 +00:00
|
|
|
ExecSystem("/usr/bin/apt install -y openssl")
|
2024-05-15 05:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func instDepsDebian() {
|
2024-05-16 07:42:38 +00:00
|
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL from Debian repo\033[0m\n")
|
2024-05-17 08:39:55 +00:00
|
|
|
ExecSystem("/usr/bin/apt update")
|
2024-05-16 07:42:38 +00:00
|
|
|
ExecSystem("/usr/bin/apt install -y openssl")
|
2024-05-15 05:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func instDepsFedora() {
|
2024-05-16 07:42:38 +00:00
|
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL from Fedora repo\033[0m\n")
|
|
|
|
ExecSystem("/usr/bin/dnf install -y openssl")
|
2024-05-15 05:56:21 +00:00
|
|
|
}
|
|
|
|
|
2024-05-17 08:39:55 +00:00
|
|
|
func instDepsCentOS() {
|
|
|
|
fmt.Printf("\033[1;32mInstalling OpenSSL from CentOS repo\033[0m\n")
|
2024-05-16 07:42:38 +00:00
|
|
|
ExecSystem("/usr/bin/dnf install -y openssl")
|
2024-05-15 05:56:21 +00:00
|
|
|
}
|
|
|
|
|
2024-05-15 06:38:54 +00:00
|
|
|
|
|
|
|
func instDockerUbuntu() {
|
2024-05-17 08:39:55 +00:00
|
|
|
fmt.Printf("\033[1;32mInstalling Docker Engine from official repo\033[0m\n")
|
2024-05-15 06:38:54 +00:00
|
|
|
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
|
|
|
|
|
2024-05-17 08:39:55 +00:00
|
|
|
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
|
|
|
|
|
|
systemctl enable --now docker`
|
2024-05-15 06:38:54 +00:00
|
|
|
|
2024-05-16 05:06:38 +00:00
|
|
|
ExecSystem(docker_install)
|
2024-05-15 06:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func instDockerDebian() {
|
2024-05-17 08:39:55 +00:00
|
|
|
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)
|
2024-05-15 06:38:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func instDockerFedora() {
|
2024-05-17 08:39:55 +00:00
|
|
|
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`
|
2024-05-15 06:38:54 +00:00
|
|
|
|
2024-05-17 08:39:55 +00:00
|
|
|
ExecSystem(docker_install)
|
2024-05-15 06:38:54 +00:00
|
|
|
}
|
|
|
|
|
2024-05-17 08:39:55 +00:00
|
|
|
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)
|
2024-05-15 05:56:21 +00:00
|
|
|
}
|
|
|
|
|
2024-05-17 08:39:55 +00:00
|
|
|
|
2024-05-15 05:56:21 +00:00
|
|
|
func instDeps() {
|
|
|
|
if getDistro() == "ubuntu" {
|
|
|
|
instDepsUbuntu()
|
2024-05-15 06:38:54 +00:00
|
|
|
instDockerUbuntu()
|
2024-05-15 05:56:21 +00:00
|
|
|
} else if getDistro() == "debian" {
|
|
|
|
instDepsDebian()
|
2024-05-15 06:38:54 +00:00
|
|
|
instDockerDebian()
|
2024-05-15 05:56:21 +00:00
|
|
|
} else if getDistro() == "fedora" {
|
|
|
|
instDepsFedora()
|
2024-05-15 06:38:54 +00:00
|
|
|
instDockerFedora()
|
2024-05-17 08:39:55 +00:00
|
|
|
} else if getDistro() == "centos" {
|
|
|
|
instDepsCentOS()
|
|
|
|
instDockerCentOS()
|
2024-05-15 05:56:21 +00:00
|
|
|
} else {
|
|
|
|
fmt.Println("OS not supported")
|
|
|
|
os.Exit(3)
|
|
|
|
}
|
|
|
|
}
|