„install.sh“ ändern

This commit is contained in:
Yann Mölle 2023-04-17 21:16:56 +02:00
parent 2b61c52b7f
commit 848725967d

View File

@ -7,15 +7,27 @@ if [ "$(id -u)" -ne 0 ]; then
fi fi
# Check which Linux distribution is installed # Check which Linux distribution is installed
if [ -f /etc/debian_version ]; then if [ -f /etc/os-release ]; then
echo "Detected Debian-based system." . /etc/os-release
DISTRO="debian" if [[ "$ID" == "ubuntu" ]]; then
elif [ -f /etc/redhat-release ]; then echo "Detected Ubuntu."
echo "Detected Red Hat-based system." PACKAGE_MANAGER="apt-get-ubuntu"
DISTRO="redhat" elif [[ "$ID" == "opensuse" ]]; then
elif [ -f /etc/alpine-release ]; then echo "Detected openSUSE."
echo "Detected Alpine Linux." PACKAGE_MANAGER="zypper"
DISTRO="alpine" elif [[ "$ID" == "debian" ]]; then
echo "Detected Debian."
PACKAGE_MANAGER="apt-get"
elif [[ "$ID" == "alpine" ]]; then
echo "Detected Alpine Linux."
PACKAGE_MANAGER="apk"
elif [[ "$ID" == "centos" ]]; then
echo "Detected CentOS."
PACKAGE_MANAGER="yum"
else
echo "Unsupported Linux distribution."
exit 1
fi
else else
echo "Unsupported Linux distribution." echo "Unsupported Linux distribution."
exit 1 exit 1
@ -23,14 +35,32 @@ fi
# Install Docker # Install Docker
echo "Installing Docker..." echo "Installing Docker..."
if [ "$DISTRO" = "debian" ] || [ "$DISTRO" = "ubuntu" ]; then $PACKAGE_MANAGER update
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/debian.sh)" $PACKAGE_MANAGER install -y docker
systemctl start docker
elif [ "$DISTRO" = "redhat" ]; then # Start Docker
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/centos.sh)" echo "Starting Docker..."
systemctl start docker systemctl start docker
elif [ "$DISTRO" = "alpine" ]; then
sh -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/alpine.sh)" # Enable Docker to start at boot
echo "Enabling Docker at boot..."
systemctl enable docker
# Install Docker Compose
read -p "Do you want to install Docker Compose? (y/n) " INSTALL_COMPOSE
if [ "$INSTALL_COMPOSE" == "y" ]; then
echo "Installing Docker Compose..."
if [ "$PACKAGE_MANAGER" == "apt-get" ] then
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/debian.sh)"
elif [ "$PACKAGE_MANAGER" == "apt-get-ubuntu" ]; then
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/ubuntu.sh)"
elif [ "$PACKAGE_MANAGER" == "zypper" ]; then
sh -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/opensuse.sh)"
elif [ "$PACKAGE_MANAGER" == "apk" ]; then
sh -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/alpine.sh)"
elif [ "$PACKAGE_MANAGER" == "yum" ]; then
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/centos.sh)"
fi
fi fi
echo "Docker and Docker Compose installation completed." echo "Docker and Docker Compose installation completed."