Add install for DRB bot
This commit is contained in:
45
install.sh
45
install.sh
@@ -6,20 +6,32 @@ GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m' # Added yellow for warnings/info
|
||||
NC='\033[0m' # No Color - resets text to default color
|
||||
|
||||
# Function to check if Docker is installed and running
|
||||
check_docker_status() {
|
||||
echo -e "${YELLOW}Checking Docker status...${NC}"
|
||||
if ! command -v docker &> /dev/null; then
|
||||
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
|
||||
install_prereqs() {
|
||||
echo -e "${GREEN}Installing Prerequisites...${NC}"
|
||||
apt-get update
|
||||
apt-get install docker.io
|
||||
}
|
||||
|
||||
if ! docker info &> /dev/null; then
|
||||
echo -e "${RED}Error: Docker daemon is not running. Please start Docker and try again.${NC}"
|
||||
exit 1
|
||||
install_discord_bot() {
|
||||
local drb_container_name="drb-client-discord-bot"
|
||||
# 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
|
||||
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() {
|
||||
@@ -91,13 +103,16 @@ start_docker_container() {
|
||||
|
||||
# --- Main script execution ---
|
||||
|
||||
# 1. Check Docker status
|
||||
# 1. Install PreReqs
|
||||
install_prereqs
|
||||
|
||||
# 2. Check Docker status
|
||||
check_docker_status
|
||||
|
||||
# 2. Create config.json
|
||||
# 3. Create config.json
|
||||
create_config_json
|
||||
|
||||
# 3. Build and Start Docker container
|
||||
# 4. Build and Start Docker container
|
||||
start_docker_container
|
||||
|
||||
echo -e "${GREEN}--- All installation and startup steps finished ---${NC}"
|
||||
Reference in New Issue
Block a user