Files
AzerothCore-RealmMaster/scripts/hooks/copy-standard-lua
uprightbass360 64d0478320 feat: refactor post-install hooks to manifest-driven system
- Replace hardcoded hooks with external scripts in scripts/hooks/
- Add 4 generic hook scripts (copy-standard-lua, copy-aio-lua, mod-ale-patches, black-market-setup)
- Update all 28 module hook definitions in config/modules.json
- Remove legacy hook functions from manage-modules.sh
- Add 26 new Eluna Lua modules to .env.template (disabled by default)
- Add 3 new AIO modules to .env.template (disabled by default)
- Implement proper environment variable interface for hooks
- Add comprehensive documentation and refactoring summary

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-11-01 18:53:34 -04:00

61 lines
1.9 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Generic hook to copy standard Lua scripts to runtime location
set -e
# Hook environment
MODULE_KEY="${MODULE_KEY:-}"
MODULE_DIR="${MODULE_DIR:-}"
MODULE_NAME="${MODULE_NAME:-}"
MODULES_ROOT="${MODULES_ROOT:-/modules}"
LUA_SCRIPTS_TARGET="${LUA_SCRIPTS_TARGET:-/azerothcore/lua_scripts}"
if [ -z "$MODULE_DIR" ] || [ ! -d "$MODULE_DIR" ]; then
echo "❌ copy-standard-lua: Invalid module directory: $MODULE_DIR"
exit 2
fi
echo "📜 copy-standard-lua: Processing $MODULE_NAME"
# Create target directory
mkdir -p "$LUA_SCRIPTS_TARGET" 2>/dev/null || {
echo "⚠️ copy-standard-lua: Cannot create target directory $LUA_SCRIPTS_TARGET"
exit 1
}
copied_count=0
# Function to copy files and count them
copy_lua_files() {
local source_pattern="$1"
local label="$2"
if compgen -G "$source_pattern" > /dev/null 2>&1; then
echo " 📂 Found $label"
for lua_file in $source_pattern; do
if [ -f "$lua_file" ]; then
local basename_file
basename_file="$(basename "$lua_file")"
if cp "$lua_file" "$LUA_SCRIPTS_TARGET/$basename_file" 2>/dev/null; then
echo " ✅ Copied $basename_file"
copied_count=$((copied_count + 1))
else
echo " ⚠️ Failed to copy $basename_file"
fi
fi
done
fi
}
# Search patterns (in priority order)
copy_lua_files "$MODULE_DIR/lua_scripts/*.lua" "lua_scripts/ directory"
copy_lua_files "$MODULE_DIR/Server Files/lua_scripts/*.lua" "Server Files/lua_scripts/ (Black Market pattern)"
copy_lua_files "$MODULE_DIR/scripts/*.lua" "scripts/ directory"
copy_lua_files "$MODULE_DIR/*.lua" "root level Lua files"
if [ $copied_count -eq 0 ]; then
echo " No Lua scripts found in standard locations"
exit 0
fi
echo " ✅ Copied $copied_count Lua script(s) to $LUA_SCRIPTS_TARGET"
exit 0