TC2-BBS-mesh/docker/auto_docker_install_debian.sh

36 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash
# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
echo -e "\e[31mERROR: This script must be run as root. Please switch to root using 'sudo -i' or 'su - root' and try again.\e[0m"
exit 1
fi
2024-06-29 04:03:59 -07:00
if ! systemctl status docker &> /dev/null; then
echo -e "\e[32mINFO: Install Docker...\e[0m"
2024-06-29 04:03:59 -07:00
apt-get install curl -y
curl -fsSL https://get.docker.com | bash
fi
echo -e "\e[32mINFO: Docker is installed!\e[0m"
if [ -e "./TC2-BBS-mesh-docker/docker-compose.yaml" ]; then
echo -e "\e[32mINFO: TC2-BBS-mesh-docker folder is already present!\e[0m"
else
2024-06-29 04:03:59 -07:00
echo -e "\e[32mINFO: Installing TC2-BBS-mesh Docker Container in $(pwd)/TC2-BBS-mesh-docker ...\e[0m"
mkdir ./TC2-BBS-mesh-docker
2024-06-29 04:03:59 -07:00
cd TC2-BBS-mesh-docker
cat << EOF > docker-compose.yaml
services:
tc2-bbs-mesh:
image: thealhu/tc2-bbs-mesh:latest
restart: always
volumes:
- ./config:/config
container_name: tc2-bbs-mesh
# -- These parameters are optional and can be uncommented if needed. --
# devices:
# - /dev/ttyUSB0:/dev/ttyUSB0
# - /dev/ttyACM0:/dev/ttyACM0
EOF
2024-06-29 04:03:59 -07:00
docker compose up
echo "" && echo ""
echo -e "\e[32mINFO: The TC2-BBS-mesh Docker container is now installed in $(pwd)/\e[0m"
echo -e "\e[32mINFO: Please make your changes to the configuration and then run ""$""docker compose up -d in $(pwd)/\e[0m"
fi