diff --git a/scripts/auto-post-install.sh b/scripts/auto-post-install.sh index a732e62..022c2ab 100755 --- a/scripts/auto-post-install.sh +++ b/scripts/auto-post-install.sh @@ -86,9 +86,40 @@ else exit 1 fi - # Step 1: Update configuration files + # Step 1: Create module configuration files echo "" - echo "🔧 Step 1: Updating configuration files..." + echo "🔧 Step 1: Creating module configuration files..." + + # Create .conf files from .dist.conf templates for all modules + CONFIG_DIR="/azerothcore/config" + created_count=0 + + for file in "$CONFIG_DIR"/*.dist; do + if [ -f "$file" ]; then + conffile=$(echo "$file" | sed 's/.dist$//') + filename=$(basename "$conffile") + + # Skip core config files (already handled) + case "$filename" in + authserver.conf|worldserver.conf|dbimport.conf) + continue + ;; + esac + + # Create .conf file if it doesn't exist + if [ ! -f "$conffile" ]; then + echo " 📝 Creating $filename from $(basename "$file")" + cp "$file" "$conffile" + created_count=$((created_count + 1)) + fi + fi + done + + echo " ✅ Created $created_count module configuration files" + + # Step 2: Update configuration files + echo "" + echo "🔧 Step 2: Updating configuration files..." # Update DB connection lines and any necessary settings directly with sed sed -i "s|^LoginDatabaseInfo *=.*|LoginDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_AUTH_NAME}\"|" /azerothcore/config/authserver.conf || true @@ -102,9 +133,9 @@ else echo "✅ Configuration files updated" - # Step 2: Update realmlist table + # Step 3: Update realmlist table echo "" - echo "🌐 Step 2: Updating realmlist table..." + echo "🌐 Step 3: Updating realmlist table..." mysql -h "${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" --skip-ssl-verify "${DB_AUTH_NAME}" -e " UPDATE realmlist SET address='${SERVER_ADDRESS}', port=${REALM_PORT} WHERE id=1; " || echo "âš ī¸ Could not update realmlist table" @@ -112,7 +143,7 @@ else echo "✅ Realmlist updated" echo "" - echo "â„šī¸ Step 3: (Optional) Restart services to apply changes — handled externally" + echo "â„šī¸ Step 4: (Optional) Restart services to apply changes — handled externally" # Create completion marker echo "$(date)" > /install-markers/post-install-completed diff --git a/scripts/copy-module-configs.sh b/scripts/copy-module-configs.sh new file mode 100755 index 0000000..22dae1f --- /dev/null +++ b/scripts/copy-module-configs.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copy module .dist.conf files to .conf files for proper configuration loading +# This ensures all module configurations are available and can be customized + +CONFIG_DIR="${STORAGE_PATH:-/nfs/azerothcore}/config" + +echo "Creating module .conf files from .dist.conf templates..." + +cd "$CONFIG_DIR" || { + echo "Error: Cannot access config directory: $CONFIG_DIR" + exit 1 +} + +# Counter for created files +created_count=0 + +# Process all .dist files except authserver, worldserver, dbimport (already handled) +for file in *.dist; do + conffile=$(echo "$file" | sed 's/.dist$//') + + # Skip if it's a core config file (already handled) + case "$conffile" in + authserver.conf|worldserver.conf|dbimport.conf) + continue + ;; + esac + + # Create .conf file if it doesn't exist + if [ ! -f "$conffile" ]; then + echo "Creating $conffile from $file" + cp "$file" "$conffile" + created_count=$((created_count + 1)) + else + echo "Skipping $conffile (already exists)" + fi +done + +echo "Created $created_count module configuration files" +echo "Module configuration files are now ready for customization" + +# List all .conf files for verification +echo "" +echo "Available configuration files:" +ls -1 *.conf | sort \ No newline at end of file