#!/usr/bin/env bash # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { command -v "$@" >/dev/null 2>&1 } if command_exists curl; then eval "$(curl -fsSL https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh)" else echo "curl is required, but not installed" exit 1 fi init_docker() { if command -v docker >/dev/null 2>&1; then echo_info "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)" read -r dgroup /dev/null clear && echo_info "Addet repository. Updating and installing now.." sleep 1 $_sudo apt-get update $_sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ;; ubuntu) clear echo_info "executing ubuntu" sleep 2 $_sudo apt-get update && $_sudo apt-get install -y ca-certificates curl && $_sudo install -m 0755 -d /etc/apt/keyrings && $_sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && $_sudo 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" | $_sudo tee /etc/apt/sources.list.d/docker.list >/dev/null clear && echo_info "Addet repository. Updating and installing now.." sleep 0.5 $_sudo apt-get update $_sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ;; fedora) clear echo_info "executing fedora" sleep 2 $_sudo dnf -y install dnf-plugins-core $_sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo $_sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ;; *) echo "$distro is not supported by this script" ;; esac } if main; then init_docker fi