Merge remote-tracking branch 'upstream/master' into feature/core_merge_10_2025

# Conflicts:
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
#	src/server/game/Server/WorldSession.cpp
#	src/server/game/Server/WorldSession.h
#	src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
#	src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
#	src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
#	src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
#	src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
This commit is contained in:
bash
2025-10-19 22:34:18 +02:00
448 changed files with 22792 additions and 5924 deletions

View File

@@ -143,6 +143,7 @@ function comp_compile() {
mkdir -p "$AC_BINPATH_FULL"
echo "Creating $confDir..."
mkdir -p "$confDir"
mkdir -p "$confDir/modules"
echo "Cmake install..."
$SUDO cmake --install . --config $CTYPE
@@ -156,6 +157,8 @@ function comp_compile() {
echo "Setting permissions on binary files"
find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec $SUDO chown root:root -- {} +
find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec $SUDO chmod u+s -- {} +
$SUDO setcap cap_sys_nice=eip "$AC_BINPATH_FULL/worldserver"
$SUDO setcap cap_sys_nice=eip "$AC_BINPATH_FULL/authserver"
fi
[[ -f "$confDir/worldserver.conf.dist" ]] && \
@@ -165,6 +168,12 @@ function comp_compile() {
[[ -f "$confDir/dbimport.conf.dist" ]] && \
cp -v --no-clobber "$confDir/dbimport.conf.dist" "$confDir/dbimport.conf"
for f in "$confDir/modules/"*.dist
do
[[ -e $f ]] || break # handle the case of no *.dist files
cp -v --no-clobber "$f" "${f%.dist}";
done
echo "Done"
;;
esac

View File

@@ -155,7 +155,7 @@ function inst_simple_restarter {
function inst_download_client_data {
# change the following version when needed
local VERSION=v16
local VERSION=v17
echo "#######################"
echo "Client data downloader"

View File

@@ -127,10 +127,13 @@ function inst_module_help() {
echo " ./acore.sh module # Interactive menu"
echo " ./acore.sh module search [terms...]"
echo " ./acore.sh module install [--all | modules...]"
echo " ./acore.sh module update [--all | modules...]"
echo " ./acore.sh module update [--discard-changes] [--all | modules...]"
echo " ./acore.sh module remove [modules...]"
echo " ./acore.sh module list # List installed modules"
echo ""
echo "Options:"
echo " --discard-changes Reset module repositories to a clean state before updating"
echo ""
echo "Module Specification Syntax:"
echo " name # Simple name (e.g., mod-transmog)"
echo " owner/name # GitHub repository"
@@ -602,6 +605,37 @@ function inst_mod_is_installed() {
return 1
}
# Discard local changes from a module repository to guarantee a clean update.
function inst_module_reset_repo() {
local repo_ref="$1"
local dirname="$2"
local repo_path="$J_PATH_MODULES/$dirname"
if [ ! -d "$repo_path" ]; then
print_error "[$repo_ref] Cannot discard changes; path not found ($repo_path)."
return 1
fi
if [ ! -d "$repo_path/.git" ]; then
print_error "[$repo_ref] Cannot discard changes; $repo_path is not a git repository."
return 1
fi
print_warn "[$repo_ref] Discarding local changes (--discard-changes)."
if ! git -C "$repo_path" reset --hard >/dev/null 2>&1; then
print_error "[$repo_ref] Failed to reset repository at $repo_path."
return 1
fi
if ! git -C "$repo_path" clean -fd >/dev/null 2>&1; then
print_error "[$repo_ref] Failed to remove untracked files from $repo_path."
return 1
fi
return 0
}
# =============================================================================
# Conflict Detection and Validation
# =============================================================================
@@ -901,31 +935,48 @@ function inst_module_install {
# Update one or more modules
function inst_module_update {
# Handle help request
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
inst_module_help
return 0
fi
# Support multiple modules and the --all flag; prompt if none specified.
local args=("$@")
local modules=()
local use_all=false
if [ ${#args[@]} -gt 0 ] && { [ "${args[0]}" = "--all" ] || [ "${args[0]}" = "-a" ]; }; then
use_all=true
shift || true
fi
local discard_changes=false
local had_errors=0
local _tmp=$PWD
while [[ $# -gt 0 ]]; do
case "$1" in
--help|-h)
inst_module_help
return 0
;;
--all|-a)
use_all=true
;;
--discard-changes|--reset|-r)
discard_changes=true
;;
--)
shift || true
while [[ $# -gt 0 ]]; do
modules+=("$1")
shift || true
done
break
;;
*)
modules+=("$1")
;;
esac
shift || true
done
if $use_all; then
local line repo_ref branch commit newCommit owner modname url dirname
local repo_ref branch commit owner modname url dirname newCommit
local parsed_output
while read -r repo_ref branch commit; do
[ -z "$repo_ref" ] && continue
# Skip excluded modules during update --all
if inst_mod_is_excluded "$repo_ref"; then
print_warn "[$repo_ref] Excluded by MODULES_EXCLUDE_LIST (skipping)."
continue
fi
parsed_output=$(inst_parse_module_spec "$repo_ref")
IFS=' ' read -r _ owner modname _ _ url dirname <<< "$parsed_output"
@@ -935,16 +986,23 @@ function inst_module_update {
continue
fi
if $discard_changes; then
if ! inst_module_reset_repo "$repo_ref" "$dirname"; then
had_errors=1
continue
fi
fi
if Joiner:upd_repo "$url" "$dirname" "$branch" ""; then
newCommit=$(git -C "$J_PATH_MODULES/$dirname" rev-parse HEAD 2>/dev/null || echo "")
inst_mod_list_upsert "$repo_ref" "$branch" "$newCommit"
print_success "[$repo_ref] Updated to latest commit on '$branch'."
else
print_error "[$repo_ref] Cannot update"
had_errors=1
fi
done < <(inst_mod_list_read)
else
local modules=("$@")
if [ ${#modules[@]} -eq 0 ]; then
echo "Type the name(s) of the module(s) to update"
read -p "Insert name(s): " _line
@@ -952,6 +1010,7 @@ function inst_module_update {
fi
local spec repo_ref override_branch override_commit owner modname url dirname v b branch def newCommit
local parsed_output
for spec in "${modules[@]}"; do
[ -z "$spec" ] && continue
parsed_output=$(inst_parse_module_spec "$spec")
@@ -959,11 +1018,10 @@ function inst_module_update {
dirname="${dirname:-$modname}"
if [ -d "$J_PATH_MODULES/$dirname/" ]; then
# determine preferred branch if not provided
b=""
if [ -n "$override_branch" ] && [ "$override_branch" != "-" ]; then
b="$override_branch"
else
# try reading acore-module.json for this repo
if [[ "$url" =~ github.com ]]; then
read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/${owner}/${modname}/master/acore-module.json")
else
@@ -981,21 +1039,35 @@ function inst_module_update {
fi
fi
if $discard_changes; then
if ! inst_module_reset_repo "$repo_ref" "$dirname"; then
had_errors=1
continue
fi
fi
if Joiner:upd_repo "$url" "$dirname" "$b" ""; then
newCommit=$(git -C "$J_PATH_MODULES/$dirname" rev-parse HEAD 2>/dev/null || echo "")
inst_mod_list_upsert "$repo_ref" "$b" "$newCommit"
print_success "[$repo_ref] Done, please re-run compiling and db assembly"
else
print_error "[$repo_ref] Cannot update"
had_errors=1
fi
else
print_error "[$repo_ref] Cannot update! Path doesn't exist ($J_PATH_MODULES/$dirname/)"
had_errors=1
fi
done
fi
echo ""
echo ""
if [ "$had_errors" -ne 0 ]; then
return 1
fi
return 0
}
# Remove one or more modules

View File

@@ -453,6 +453,40 @@ This is particularly useful for:
- **Multiple Projects**: Separate service configurations per project
- **Team Collaboration**: Share service setups across development teams
#### Service Configuration Portability
The service manager automatically stores binary and configuration paths as relative paths when they are located under the `AC_SERVICE_CONFIG_DIR`, making service configurations portable across environments:
```bash
# Set up a portable project structure
export AC_SERVICE_CONFIG_DIR="/opt/myproject/services"
mkdir -p "$AC_SERVICE_CONFIG_DIR"/{bin,etc}
# Copy your binaries and configs
cp /path/to/compiled/authserver "$AC_SERVICE_CONFIG_DIR/bin/"
cp /path/to/authserver.conf "$AC_SERVICE_CONFIG_DIR/etc/"
# Create service - paths under AC_SERVICE_CONFIG_DIR will be stored as relative
./service-manager.sh create auth authserver \
--bin-path "$AC_SERVICE_CONFIG_DIR/bin" \
--server-config "$AC_SERVICE_CONFIG_DIR/etc/authserver.conf"
# Registry will contain relative paths like "bin/authserver" and "etc/authserver.conf"
# instead of absolute paths, making the entire directory portable
```
**Benefits:**
- **Environment Independence**: Move the entire services directory between machines
- **Container Friendly**: Perfect for Docker volumes and bind mounts
- **Backup/Restore**: Archive and restore complete service configurations
- **Development/Production Parity**: Same relative structure across environments
**How it works:**
- Paths under `AC_SERVICE_CONFIG_DIR` are automatically stored as relative paths
- Paths outside `AC_SERVICE_CONFIG_DIR` are stored as absolute paths for safety
- When services are restored or started, relative paths are resolved from `AC_SERVICE_CONFIG_DIR`
- If `AC_SERVICE_CONFIG_DIR` is not set, all paths are stored as absolute paths (traditional behavior)
#### Migration from Legacy Format
If you have existing services in the old format, use the migration script:

View File

@@ -219,6 +219,13 @@ function parse_arguments() {
export PARSED_CONFIG_FILE="$config_file"
export PARSED_SERVERCONFIG="$serverconfig"
export PARSED_SESSION_MANAGER="$session_manager"
echo "Parsed arguments:"
echo " Mode: $PARSED_MODE"
echo " Server Binary: $PARSED_SERVERBIN"
echo " Config File: $PARSED_CONFIG_FILE"
echo " Server Config: $PARSED_SERVERCONFIG"
echo " Session Manager: $PARSED_SESSION_MANAGER"
}
# Start service (single run or with simple-restarter)

File diff suppressed because it is too large Load Diff

183
apps/startup-scripts/test/test_startup_scripts.bats Normal file → Executable file
View File

@@ -160,7 +160,19 @@ teardown() {
# Create registry with pm2 provider service
cat > "$AC_SERVICE_CONFIG_DIR/service_registry.json" << 'EOF'
[
{"name":"test-world","provider":"pm2","type":"service","bin_path":"/bin/worldserver","args":"","systemd_type":"--user","restart_policy":"always"}
{
"name":"test-world",
"provider":"pm2",
"type":"service",
"bin_path":"/bin/worldserver",
"args":"",
"systemd_type":"--user",
"restart_policy":"always",
"exec":{
"command":"/bin/true",
"args":[]
}
}
]
EOF
# Create minimal service config and run-engine config files required by 'send'
@@ -215,7 +227,19 @@ EOF
# Create registry and config as in previous test
cat > "$AC_SERVICE_CONFIG_DIR/service_registry.json" << 'EOF'
[
{"name":"test-world","provider":"pm2","type":"service","bin_path":"/bin/worldserver","args":"","systemd_type":"--user","restart_policy":"always"}
{
"name":"test-world",
"provider":"pm2",
"type":"service",
"bin_path":"/bin/worldserver",
"args":"",
"systemd_type":"--user",
"restart_policy":"always",
"exec":{
"command":"/bin/true",
"args":[]
}
}
]
EOF
echo "RUN_ENGINE_CONFIG_FILE=\"$AC_SERVICE_CONFIG_DIR/test-world-run-engine.conf\"" > "$AC_SERVICE_CONFIG_DIR/test-world.conf"
@@ -258,6 +282,31 @@ EOF
[ "$status" -eq 0 ]
}
@test "service-manager: restore helper recreates missing configs" {
command -v jq >/dev/null 2>&1 || skip "jq not installed"
export AC_SERVICE_CONFIG_DIR="$TEST_DIR/services"
mkdir -p "$AC_SERVICE_CONFIG_DIR"
source "$SCRIPT_DIR/service-manager.sh"
local service_name="restore-test"
local run_engine_config="$AC_SERVICE_CONFIG_DIR/$service_name-run-engine.conf"
local service_conf="$AC_SERVICE_CONFIG_DIR/$service_name.conf"
rm -f "$run_engine_config" "$service_conf"
mkdir -p "$TEST_DIR/bin" "$TEST_DIR/etc"
touch "$TEST_DIR/bin/worldserver"
touch "$TEST_DIR/etc/worldserver.conf"
ensure_service_configs_restored "$service_name" "world" "systemd" "$TEST_DIR/bin/worldserver" "$TEST_DIR/etc/worldserver.conf" "always" "none" "0" "--user" "" "$run_engine_config"
[ -f "$run_engine_config" ]
[ -f "$service_conf" ]
grep -Fq 'export SESSION_MANAGER="none"' "$run_engine_config"
grep -Fq 'export BINPATH="'$TEST_DIR'/bin"' "$run_engine_config"
grep -Fq "RUN_ENGINE_CONFIG_FILE=\"$run_engine_config\"" "$service_conf"
grep -Fq 'RESTART_POLICY="always"' "$service_conf"
}
@test "service-manager: wait-uptime times out for unknown service" {
command -v jq >/dev/null 2>&1 || skip "jq not installed"
export AC_SERVICE_CONFIG_DIR="$TEST_DIR/services"
@@ -279,6 +328,136 @@ EOF
[[ "$output" =~ "Configuration file not found" ]]
}
# ===== PATH PORTABILITY TESTS =====
@test "service-manager: path conversion functions work correctly" {
# Source the service-manager script to access helper functions
source "$SCRIPT_DIR/service-manager.sh"
# Test make_path_relative without AC_SERVICE_CONFIG_DIR
unset AC_SERVICE_CONFIG_DIR
result=$(make_path_relative "/absolute/path/test")
[[ "$result" == "/absolute/path/test" ]]
# Test make_path_relative with AC_SERVICE_CONFIG_DIR
export AC_SERVICE_CONFIG_DIR="/tmp/test-config"
mkdir -p "$AC_SERVICE_CONFIG_DIR/subdir"
result=$(make_path_relative "$AC_SERVICE_CONFIG_DIR/subdir/binary")
[[ "$result" == "subdir/binary" ]]
result=$(make_path_relative "/opt/bin/authserver")
[[ "$result" == "../../opt/bin/authserver" ]]
# Test make_path_absolute
result=$(make_path_absolute "subdir/binary")
[[ "$result" == "$AC_SERVICE_CONFIG_DIR/subdir/binary" ]]
result=$(make_path_absolute "../../opt/bin/authserver")
[[ "$result" == "/opt/bin/authserver" ]]
# Test absolute path stays absolute
result=$(make_path_absolute "/absolute/path")
[[ "$result" == "/absolute/path" ]]
# Cleanup
rm -rf "$AC_SERVICE_CONFIG_DIR"
unset AC_SERVICE_CONFIG_DIR
}
@test "service-manager: registry stores relative paths when possible" {
# Set up test environment
export AC_SERVICE_CONFIG_DIR="$TEST_DIR/service-config"
mkdir -p "$AC_SERVICE_CONFIG_DIR"
# Create a temporary service registry in our test directory
local test_registry="$AC_SERVICE_CONFIG_DIR/test_registry.json"
echo "[]" > "$test_registry"
# Source the service-manager and override REGISTRY_FILE
source "$SCRIPT_DIR/service-manager.sh"
REGISTRY_FILE="$test_registry"
# Create test binary directory under config dir
mkdir -p "$AC_SERVICE_CONFIG_DIR/bin"
# Test that paths under AC_SERVICE_CONFIG_DIR are stored as relative
add_service_to_registry "test-service" "pm2" "auth" "$AC_SERVICE_CONFIG_DIR/bin/authserver" "--config test.conf" "" "always" "none" "0" "" "$AC_SERVICE_CONFIG_DIR/etc/test.conf"
# Check that paths were stored as relative
local stored_bin_path=$(jq -r '.[0].bin_path' "$test_registry")
local stored_config_path=$(jq -r '.[0].server_config' "$test_registry")
[[ "$stored_bin_path" == "bin/authserver" ]]
[[ "$stored_config_path" == "etc/test.conf" ]]
# Test that absolute paths outside config dir are stored as absolute
add_service_to_registry "test-service2" "pm2" "auth" "/opt/azerothcore/bin/authserver" "--config test.conf" "" "always" "none" "0" "" "/opt/azerothcore/etc/test.conf"
local stored_bin_path2=$(jq -r '.[1].bin_path' "$test_registry")
local stored_config_path2=$(jq -r '.[1].server_config' "$test_registry")
local expected_bin_rel=$(make_path_relative "/opt/azerothcore/bin/authserver")
local expected_cfg_rel=$(make_path_relative "/opt/azerothcore/etc/test.conf")
[[ "$stored_bin_path2" == "$expected_bin_rel" ]]
[[ "$stored_config_path2" == "$expected_cfg_rel" ]]
# Cleanup
rm -rf "$AC_SERVICE_CONFIG_DIR"
unset AC_SERVICE_CONFIG_DIR
}
@test "service-manager: restore --sync-only recreates config files" {
command -v jq >/dev/null 2>&1 || skip "jq not installed"
export AC_SERVICE_CONFIG_DIR="$TEST_DIR/services"
mkdir -p "$AC_SERVICE_CONFIG_DIR"
cat > "$AC_SERVICE_CONFIG_DIR/service_registry.json" <<'EOF'
[
{
"name": "sync-test",
"provider": "pm2",
"type": "auth",
"bin_path": "bin/authserver",
"exec": {
"command": "../src/run-engine",
"args": [
"start",
"bin/authserver",
"--config",
"sync-test-run-engine.conf"
]
},
"args": "",
"created": "2025-10-12T20:00:54+02:00",
"status": "active",
"systemd_type": "--user",
"restart_policy": "always",
"session_manager": "none",
"gdb_enabled": "0",
"pm2_opts": " ",
"server_config": "etc/authserver.conf"
}
]
EOF
rm -f "$AC_SERVICE_CONFIG_DIR/sync-test.conf" "$AC_SERVICE_CONFIG_DIR/sync-test-run-engine.conf"
mkdir -p "$AC_SERVICE_CONFIG_DIR/bin" "$AC_SERVICE_CONFIG_DIR/etc"
touch "$AC_SERVICE_CONFIG_DIR/bin/authserver"
touch "$AC_SERVICE_CONFIG_DIR/etc/authserver.conf"
run "$SCRIPT_DIR/service-manager.sh" restore --sync-only
debug_on_failure
[ "$status" -eq 0 ]
[ -f "$AC_SERVICE_CONFIG_DIR/sync-test.conf" ]
[ -f "$AC_SERVICE_CONFIG_DIR/sync-test-run-engine.conf" ]
grep -Fq "RUN_ENGINE_CONFIG_FILE=\"$AC_SERVICE_CONFIG_DIR/sync-test-run-engine.conf\"" "$AC_SERVICE_CONFIG_DIR/sync-test.conf"
grep -Fq "export BINPATH=\"$AC_SERVICE_CONFIG_DIR/bin\"" "$AC_SERVICE_CONFIG_DIR/sync-test-run-engine.conf"
}
@test "examples: restarter-auth should show configuration error" {
run "$SCRIPT_DIR/examples/restarter-auth.sh"
[[ "$output" =~ "Configuration file not found" ]]