Add install for DRB bot

This commit is contained in:
Logan Cusano
2025-06-29 00:33:47 -04:00
parent 663e2c8305
commit c2858e3ef2

View File

@@ -6,20 +6,32 @@ GREEN='\033[0;32m'
YELLOW='\033[0;33m' # Added yellow for warnings/info YELLOW='\033[0;33m' # Added yellow for warnings/info
NC='\033[0m' # No Color - resets text to default color NC='\033[0m' # No Color - resets text to default color
# Function to check if Docker is installed and running install_prereqs() {
check_docker_status() { echo -e "${GREEN}Installing Prerequisites...${NC}"
echo -e "${YELLOW}Checking Docker status...${NC}" apt-get update
if ! command -v docker &> /dev/null; then apt-get install docker.io
echo -e "${RED}Error: Docker is not installed. Please install Docker to proceed.${NC}" }
echo -e "${RED}You can find installation instructions at: https://docs.docker.com/get-docker/${NC}"
exit 1
fi
if ! docker info &> /dev/null; then install_discord_bot() {
echo -e "${RED}Error: Docker daemon is not running. Please start Docker and try again.${NC}" local drb_container_name="drb-client-discord-bot"
exit 1 # Stop and remove existing container if it's running/exists
if docker ps -a --format '{{.Names}}' | grep -q "^${drb_container_name}$"; then
echo -e "${YELLOW}Container '${drb_container_name}' already exists. Stopping and removing it...${NC}"
docker stop "${drb_container_name}" &> /dev/null
docker rm "${drb_container_name}" &> /dev/null
if [ $? -ne 0 ]; then
echo -e "${RED}Warning: Could not stop/remove existing container '${drb_container_name}'. It might not be running.${NC}"
fi
fi fi
echo -e "${GREEN}Docker is installed and running.${NC}" echo -e "${GREEN}Installing the discord bot...${NC}"
docker pull git.vpn.cusano.net/logan/drb-client-discord-bot/drb-client-discord-bot:nightly
docker run -d --privileged
-v /dev:/dev \
-v $(shell pwd)/configs:/configs \
--name "${drb_container_name}" \
--network=host \
--restart unless-stopped \
"${drb_container_name}"
} }
create_config_json() { create_config_json() {
@@ -91,13 +103,16 @@ start_docker_container() {
# --- Main script execution --- # --- Main script execution ---
# 1. Check Docker status # 1. Install PreReqs
install_prereqs
# 2. Check Docker status
check_docker_status check_docker_status
# 2. Create config.json # 3. Create config.json
create_config_json create_config_json
# 3. Build and Start Docker container # 4. Build and Start Docker container
start_docker_container start_docker_container
echo -e "${GREEN}--- All installation and startup steps finished ---${NC}" echo -e "${GREEN}--- All installation and startup steps finished ---${NC}"