From 274387b780b84feb430b442bbcd84ec73d10d2fb Mon Sep 17 00:00:00 2001 From: scriptos Date: Mon, 8 Apr 2024 20:37:30 +0200 Subject: [PATCH] Script now checks OS before installation --- docker-installer-ubuntu.v3.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/docker-installer-ubuntu.v3.sh b/docker-installer-ubuntu.v3.sh index 26d8b11..59d800e 100644 --- a/docker-installer-ubuntu.v3.sh +++ b/docker-installer-ubuntu.v3.sh @@ -4,12 +4,21 @@ # Aufruf: bash ./docker-installer.v3.sh # Autor: Patrick Asmus # Web: https://www.techniverse.net -# Git-Reposit.: https://git.techniverse.net/scriptos/docker-installer -# Version: 3.2.1 -# Datum: 31.03.2024 -# Modifikation: Filename changed +# Git-Reposit.: https://git.techniverse.net/scriptos/linux-docker-installer +# Version: 3.3 +# Datum: 08.04.2024 +# Modifikation: Script now checks OS before installation ##################################################### +# Betriebssystem und Version prüfen +OS=$(lsb_release -is) +VERSION=$(lsb_release -rs) + +if [ "$OS" != "Ubuntu" ] || [ "$VERSION" != "22.04" ]; then + echo "Dieses Script ist nur für Ubuntu 22.04 geeignet. Installation abgebrochen." + exit 1 +fi + # Variablen USER="root" DOCKER_ROOT_DIR="/docker" @@ -24,7 +33,7 @@ sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io sudo usermod -aG docker $USER -# Docker-Root-Verzeichnis ändern +# Docker-Root-Verzeichnis ändern & Compose Verzeichnis erstellen sudo systemctl stop docker sudo mkdir -p $DOCKER_ROOT_DIR echo "{\"data-root\": \"$DOCKER_ROOT_DIR\"}" | sudo tee /etc/docker/daemon.json @@ -32,7 +41,6 @@ cp /var/lib/docker/* $DOCKER_ROOT_DIR rm -R /var/lib/docker sudo systemctl start docker -# Erstelle Compose-Verzeichnis mkdir $COMPOSE_DIR # Docker-compose installieren @@ -48,4 +56,4 @@ sudo sed -i 's/plugins=(git)/plugins=(git docker)/g' /root/.zshrc docker --version docker-compose --version -exit 0 +exit 0 \ No newline at end of file