docker-aio/install.sh

54 lines
1.9 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
2023-04-17 21:16:56 +02:00
if [ -f /etc/os-release ]; then
. /etc/os-release
2023-04-17 21:19:33 +02:00
if [ "$ID" == "ubuntu" ]; then
2023-04-17 21:16:56 +02:00
echo "Detected Ubuntu."
PACKAGE_MANAGER="apt-get-ubuntu"
2023-04-17 21:19:33 +02:00
elif [ "$ID" == "opensuse" ]; then
2023-04-17 21:16:56 +02:00
echo "Detected openSUSE."
PACKAGE_MANAGER="zypper"
2023-04-17 21:19:33 +02:00
elif [ "$ID" == "debian" ]; then
2023-04-17 21:16:56 +02:00
echo "Detected Debian."
PACKAGE_MANAGER="apt-get"
2023-04-17 21:19:33 +02:00
elif [ "$ID" == "alpine" ]; then
2023-04-17 21:16:56 +02:00
echo "Detected Alpine Linux."
PACKAGE_MANAGER="apk"
2023-04-17 21:19:33 +02:00
elif [ "$ID" == "centos" ]; then
2023-04-17 21:16:56 +02:00
echo "Detected CentOS."
PACKAGE_MANAGER="yum"
else
echo "Unsupported Linux distribution."
exit 1
fi
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 21:16:56 +02:00
2023-04-17 21:17:55 +02:00
# Install Docker
read -p "Do you want to install Docker? (y/n) " INSTALL_DOCKER
if [ "$INSTALL_DOCKER" == "y" ]; then
echo "Installing Docker ..."
2023-04-17 21:16:56 +02:00
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
2023-04-17 20:49:39 +02:00
fi
2023-04-17 20:57:09 +02:00
echo "Docker and Docker Compose installation completed."