cleanup: Update paths and builds

This commit is contained in:
uprightbass360
2025-10-24 22:49:44 -04:00
parent f42ab00a31
commit d8696d2ab4
13 changed files with 261 additions and 86 deletions

View File

@@ -5,7 +5,7 @@
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
COMPOSE_FILE="$ROOT_DIR/compose.yml"
COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
ENV_FILE="$ROOT_DIR/.env"
BLUE='\033[0;34m'

View File

@@ -8,15 +8,13 @@ git config --global user.email "${GIT_EMAIL:-noreply@azerothcore.org}"
# PAT not needed for public repositories
echo 'Initializing module management...'
cd /modules
if [ "$MODULES_LOCAL_RUN" != "1" ]; then
cd /modules
fi
echo 'Cleaning up disabled modules...'
# Remove modules if disabled
if [ "$MODULE_PLAYERBOTS" != "1" ] && [ -d "mod-playerbots" ]; then
echo 'Removing mod-playerbots (disabled)...'
rm -rf mod-playerbots
fi
# Playerbots are integrated into the source - no separate module to remove
if [ "$MODULE_AOE_LOOT" != "1" ] && [ -d "mod-aoe-loot" ]; then
echo 'Removing mod-aoe-loot (disabled)...'
@@ -227,15 +225,14 @@ fi
echo 'Installing enabled modules...'
# Install Playerbots if enabled
if [ "$MODULE_PLAYERBOTS" = "1" ] && [ ! -d "mod-playerbots" ]; then
echo '🤖 Installing mod-playerbots...'
echo ' 📖 Project: https://github.com/uprightbass360/mod-playerbots'
echo ' 🚨 CRITICAL: REQUIRES Custom AzerothCore branch (uprightbass360/azerothcore-wotlk-playerbots/tree/Playerbot)'
echo ' 🚨 INCOMPATIBLE with standard AzerothCore - module will not function properly'
echo ' 🔧 REBUILD REQUIRED: Container must be rebuilt with source-based compilation'
# Playerbots handling - integrated into custom AzerothCore branch
if [ "$MODULE_PLAYERBOTS" = "1" ]; then
echo '🤖 Playerbots module enabled...'
echo ' 📖 Playerbots are integrated into the uprightbass360/azerothcore-wotlk-playerbots source'
echo ' No separate module repository needed - functionality built into core'
echo ' 🔧 REBUILD REQUIRED: Container must be rebuilt with playerbots source'
echo ' 📋 POST-INSTALL: Requires manual account/character configuration'
git clone https://github.com/uprightbass360/mod-playerbots.git mod-playerbots
# No git clone needed - playerbots are integrated into the source tree
fi
# Install AOE Loot if enabled
@@ -707,7 +704,11 @@ fi
# Module state tracking and rebuild logic
echo 'Checking for module changes that require rebuild...'
MODULES_STATE_FILE="/modules/.modules_state"
if [ "$MODULES_LOCAL_RUN" = "1" ]; then
MODULES_STATE_FILE="./.modules_state"
else
MODULES_STATE_FILE="/modules/.modules_state"
fi
CURRENT_STATE=""
REBUILD_REQUIRED=0
@@ -804,7 +805,11 @@ fi
echo 'Module management complete.'
REBUILD_SENTINEL="/modules/.requires_rebuild"
if [ "$MODULES_LOCAL_RUN" = "1" ]; then
REBUILD_SENTINEL="./.requires_rebuild"
else
REBUILD_SENTINEL="/modules/.requires_rebuild"
fi
if [ "$SQL_EXECUTION_FAILED" = "1" ]; then
echo "⚠️ SQL execution encountered issues; review logs above."
fi

View File

@@ -15,7 +15,7 @@ Options:
--port PORT SSH port (default: 22)
--identity PATH SSH private key (passed to scp/ssh)
--project-dir DIR Remote project directory (default: ~/acore-compose)
--tarball PATH Output path for the image tar (default: ./images/acore-modules-images.tar)
--tarball PATH Output path for the image tar (default: ./local-storage/images/acore-modules-images.tar)
--storage PATH Remote storage directory (default: <project-dir>/storage)
--skip-storage Do not sync the storage directory
--help Show this help
@@ -54,7 +54,10 @@ fi
PROJECT_DIR="${PROJECT_DIR:-/home/${USER}/acore-compose}"
REMOTE_STORAGE="${REMOTE_STORAGE:-${PROJECT_DIR}/storage}"
TARBALL="${TARBALL:-$(pwd)/images/acore-modules-images.tar}"
LOCAL_STORAGE_ROOT="${STORAGE_PATH_LOCAL:-./local-storage}"
LOCAL_STORAGE_ROOT="${LOCAL_STORAGE_ROOT%/}"
[ -z "$LOCAL_STORAGE_ROOT" ] && LOCAL_STORAGE_ROOT="."
TARBALL="${TARBALL:-${LOCAL_STORAGE_ROOT}/images/acore-modules-images.tar}"
SCP_OPTS=(-P "$PORT")
SSH_OPTS=(-p "$PORT")

View File

@@ -35,6 +35,9 @@ read_env(){
if [ -f "$env_path" ]; then
value="$(grep -E "^${key}=" "$env_path" | tail -n1 | cut -d'=' -f2- | tr -d '\r')"
fi
if [ -z "$value" ]; then
value="${!key:-}"
fi
if [ -z "$value" ]; then
value="$default"
fi
@@ -44,10 +47,16 @@ read_env(){
default_source_path(){
local module_playerbots
module_playerbots="$(read_env MODULE_PLAYERBOTS "0")"
local local_root
local_root="$(read_env STORAGE_PATH_LOCAL "./local-storage")"
local_root="${local_root%/}"
if [[ -z "$local_root" ]]; then
local_root="."
fi
if [ "$module_playerbots" = "1" ]; then
echo "./source/azerothcore-playerbots"
echo "${local_root}/source/azerothcore-playerbots"
else
echo "./source/azerothcore"
echo "${local_root}/source/azerothcore"
fi
}
@@ -125,6 +134,20 @@ fi
REBUILD_SOURCE_PATH="$(realpath "$REBUILD_SOURCE_PATH" 2>/dev/null || echo "$REBUILD_SOURCE_PATH")"
# Check for modules in source directory first, then fall back to shared storage
LOCAL_MODULES_DIR="$REBUILD_SOURCE_PATH/modules"
SHARED_MODULES_DIR="$STORAGE_PATH/modules"
if [ -d "$LOCAL_MODULES_DIR" ]; then
echo "🔧 Using modules from source directory: $LOCAL_MODULES_DIR"
MODULES_DIR="$LOCAL_MODULES_DIR"
SENTINEL_FILE="$LOCAL_MODULES_DIR/.requires_rebuild"
else
echo "🔧 Using modules from shared storage: $SHARED_MODULES_DIR"
MODULES_DIR="$SHARED_MODULES_DIR"
SENTINEL_FILE="$SHARED_MODULES_DIR/.requires_rebuild"
fi
SOURCE_COMPOSE="$REBUILD_SOURCE_PATH/docker-compose.yml"
if [ ! -f "$SOURCE_COMPOSE" ]; then
echo "❌ Source docker-compose.yml not found at $SOURCE_COMPOSE"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# ac-compose source repository setup
set -e
set -euo pipefail
echo '🔧 Setting up AzerothCore source repository...'
@@ -14,8 +14,9 @@ PROJECT_ROOT="$(pwd)"
# Default values
MODULE_PLAYERBOTS="${MODULE_PLAYERBOTS:-0}"
DEFAULT_STANDARD_PATH="./source/azerothcore"
DEFAULT_PLAYERBOTS_PATH="./source/azerothcore-playerbots"
LOCAL_STORAGE_ROOT="${STORAGE_PATH_LOCAL:-./local-storage}"
DEFAULT_STANDARD_PATH="${LOCAL_STORAGE_ROOT%/}/source/azerothcore"
DEFAULT_PLAYERBOTS_PATH="${LOCAL_STORAGE_ROOT%/}/source/azerothcore-playerbots"
SOURCE_PATH_DEFAULT="$DEFAULT_STANDARD_PATH"
if [ "$MODULE_PLAYERBOTS" = "1" ]; then
@@ -30,7 +31,11 @@ else
STORAGE_PATH_ABS="$STORAGE_PATH_VALUE"
fi
DEFAULT_SOURCE_ABS="$PROJECT_ROOT/${SOURCE_PATH_DEFAULT#./}"
if [[ "$SOURCE_PATH_DEFAULT" != /* ]]; then
DEFAULT_SOURCE_ABS="$PROJECT_ROOT/${SOURCE_PATH_DEFAULT#./}"
else
DEFAULT_SOURCE_ABS="$SOURCE_PATH_DEFAULT"
fi
# Convert to absolute path if relative and ensure we stay local
if [[ "$SOURCE_PATH" != /* ]]; then
@@ -62,36 +67,38 @@ echo "📍 Repository: $REPO_URL"
echo "🌿 Branch: $BRANCH"
echo "📂 Source path: $SOURCE_PATH"
# Create source directory if it doesn't exist
# Ensure destination directories exist
echo "📂 Preparing local workspace at $(dirname "$SOURCE_PATH")"
mkdir -p "$(dirname "$SOURCE_PATH")"
# Clone or update repository
if [ -d "$SOURCE_PATH/.git" ]; then
echo "📂 Existing repository found, updating..."
cd "$SOURCE_PATH"
echo "📂 Existing repository found, updating..."
cd "$SOURCE_PATH"
# Check if we're on the correct repository
CURRENT_REMOTE=$(git remote get-url origin 2>/dev/null || echo "")
if [ "$CURRENT_REMOTE" != "$REPO_URL" ]; then
echo "🔄 Repository URL changed, re-cloning..."
cd ..
rm -rf "$(basename "$SOURCE_PATH")"
git clone "$REPO_URL" "$(basename "$SOURCE_PATH")"
cd "$(basename "$SOURCE_PATH")"
fi
# Fetch latest changes
git fetch origin
# Switch to target branch
# Check if we're on the correct repository
CURRENT_REMOTE=$(git remote get-url origin 2>/dev/null || echo "")
if [ "$CURRENT_REMOTE" != "$REPO_URL" ]; then
echo "🔄 Repository URL changed, re-cloning..."
cd ..
rm -rf "$(basename "$SOURCE_PATH")"
echo "⏳ Cloning $REPO_URL (branch $BRANCH) into $(basename "$SOURCE_PATH")"
git clone -b "$BRANCH" "$REPO_URL" "$(basename "$SOURCE_PATH")"
cd "$(basename "$SOURCE_PATH")"
else
echo "🔄 Fetching latest changes from origin..."
git fetch origin --progress
echo "🔀 Switching to branch $BRANCH..."
git checkout "$BRANCH"
git pull origin "$BRANCH"
echo "⬇️ Pulling latest commits..."
git pull --ff-only origin "$BRANCH"
echo "✅ Repository updated to latest $BRANCH"
fi
else
echo "📥 Cloning repository..."
git clone -b "$BRANCH" "$REPO_URL" "$SOURCE_PATH"
echo "✅ Repository cloned successfully"
echo "📥 Cloning repository..."
echo "⏳ Cloning $REPO_URL (branch $BRANCH) into $SOURCE_PATH"
git clone -b "$BRANCH" "$REPO_URL" "$SOURCE_PATH"
echo "✅ Repository cloned successfully"
fi
cd "$SOURCE_PATH"