docker-aio/install.sh

36 lines
1.1 KiB
Bash
Raw Normal View History

2023-04-17 20:29:01 +02:00
#!/bin/bash
2023-04-17 20:49:39 +02:00
# Check if script is being run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root."
exit 1
2023-04-17 20:29:01 +02:00
fi
2023-04-17 20:49:39 +02:00
# Check which Linux distribution is installed
if [ -f /etc/debian_version ]; then
echo "Detected Debian-based system."
2023-04-17 20:51:27 +02:00
DISTRO="debian"
2023-04-17 20:49:39 +02:00
elif [ -f /etc/redhat-release ]; then
echo "Detected Red Hat-based system."
2023-04-17 20:51:27 +02:00
DISTRO="redhat"
2023-04-17 20:49:39 +02:00
elif [ -f /etc/alpine-release ]; then
echo "Detected Alpine Linux."
2023-04-17 20:51:27 +02:00
DISTRO="alpine"
2023-04-17 20:49:39 +02:00
else
2023-04-17 20:45:33 +02:00
echo "Unsupported Linux distribution."
exit 1
2023-04-17 20:49:39 +02:00
fi
2023-04-17 20:45:33 +02:00
2023-04-17 20:49:39 +02:00
# Install Docker
echo "Installing Docker..."
2023-04-17 20:51:27 +02:00
if [ "$DISTRO" = "debian" ] || [ "$DISTRO" = "ubuntu" ]; then
2023-04-17 20:54:00 +02:00
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/debian.sh)"
2023-04-17 20:57:09 +02:00
systemctl start docker
2023-04-17 20:51:27 +02:00
elif [ "$DISTRO" = "redhat" ]; then
2023-04-17 20:54:00 +02:00
bash -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/centos.sh)"
2023-04-17 20:57:09 +02:00
systemctl start docker
2023-04-17 20:51:27 +02:00
elif [ "$DISTRO" = "alpine" ]; then
2023-04-17 20:54:00 +02:00
sh -c "$(curl -L https://git.moelle.space/hxcde/docker-auto-installer/raw/branch/main/alpine.sh)"
2023-04-17 20:49:39 +02:00
fi
2023-04-17 20:57:09 +02:00
echo "Docker and Docker Compose installation completed."