Update install

This commit is contained in:
Logan Cusano
2025-06-29 02:00:07 -04:00
parent c2858e3ef2
commit ffb3e1b57f

View File

@@ -7,9 +7,15 @@ 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
install_prereqs() { install_prereqs() {
echo -e "${GREEN}Installing Prerequisites...${NC}" if id -Gn $(whoami) | grep -qw docker; then
apt-get update echo -e "${GREEN}Prerequisites Already Installed${NC}"
apt-get install docker.io else
echo -e "${GREEN}Installing Prerequisites...${NC}"
sudo apt-get update -y
sudo apt-get install docker.io -y
sudo usermod -aG docker $(whoami)
sudo reboot
fi
} }
install_discord_bot() { install_discord_bot() {
@@ -23,15 +29,16 @@ install_discord_bot() {
echo -e "${RED}Warning: Could not stop/remove existing container '${drb_container_name}'. It might not be running.${NC}" echo -e "${RED}Warning: Could not stop/remove existing container '${drb_container_name}'. It might not be running.${NC}"
fi fi
fi fi
mkdir -p $(pwd)/configs
echo -e "${GREEN}Installing the discord bot...${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 pull git.vpn.cusano.net/logan/drb-client-discord-bot/drb-client-discord-bot:nightly
docker run -d --privileged docker run -d --privileged \
-v /dev:/dev \ -v /dev:/dev \
-v $(shell pwd)/configs:/configs \ -v $(pwd)/configs:/configs \
--name "${drb_container_name}" \ --name "${drb_container_name}" \
--network=host \ --network=host \
--restart unless-stopped \ --restart unless-stopped \
"${drb_container_name}" git.vpn.cusano.net/logan/drb-client-discord-bot/drb-client-discord-bot:nightly
} }
create_config_json() { create_config_json() {
@@ -45,8 +52,11 @@ create_config_json() {
"nickname": "" "nickname": ""
}' }'
# Create data folder if it doesn't exist
mkdir -p ./data
# Write the content to config.json # Write the content to config.json
echo "$config_content" > config.json echo "$config_content" > ./data/config.json
# Check if the file was successfully created # Check if the file was successfully created
if [ -f "config.json" ]; then if [ -f "config.json" ]; then
@@ -88,7 +98,7 @@ start_docker_container() {
if docker run -d \ if docker run -d \
--name "${container_name}" \ --name "${container_name}" \
--restart unless-stopped \ --restart unless-stopped \
-v "$PWD/data":/data \ -v "$(pwd)/data":/data \
--network=host \ --network=host \
"${image_name}"; then "${image_name}"; then
echo -e "${GREEN}Docker container '${container_name}' started successfully in detached mode.${NC}" echo -e "${GREEN}Docker container '${container_name}' started successfully in detached mode.${NC}"
@@ -103,16 +113,16 @@ start_docker_container() {
# --- Main script execution --- # --- Main script execution ---
# 1. Install PreReqs # Install PreReqs
install_prereqs install_prereqs
# 2. Check Docker status # Create config.json
check_docker_status
# 3. Create config.json
create_config_json create_config_json
# 4. Build and Start Docker container # Build and Start Docker container
start_docker_container start_docker_container
# Download the drb discord bot
install_discord_bot
echo -e "${GREEN}--- All installation and startup steps finished ---${NC}" echo -e "${GREEN}--- All installation and startup steps finished ---${NC}"