mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 09:07:20 +00:00
Keep module rebuild sentinel in sync across local and shared storage
This commit is contained in:
@@ -822,14 +822,24 @@ if [ "$MODULES_LOCAL_RUN" = "1" ]; then
|
||||
else
|
||||
REBUILD_SENTINEL="/modules/.requires_rebuild"
|
||||
fi
|
||||
HOST_REBUILD_SENTINEL="${MODULES_HOST_DIR:-}"
|
||||
if [ -n "$HOST_REBUILD_SENTINEL" ]; then
|
||||
HOST_REBUILD_SENTINEL="${HOST_REBUILD_SENTINEL%/}/.requires_rebuild"
|
||||
fi
|
||||
if [ "$SQL_EXECUTION_FAILED" = "1" ]; then
|
||||
echo "⚠️ SQL execution encountered issues; review logs above."
|
||||
fi
|
||||
|
||||
if [ "$REBUILD_REQUIRED" = "1" ] && [ -n "$ENABLED_MODULES" ]; then
|
||||
echo "$ENABLED_MODULES" > "$REBUILD_SENTINEL"
|
||||
if [ -n "$HOST_REBUILD_SENTINEL" ]; then
|
||||
echo "$ENABLED_MODULES" > "$HOST_REBUILD_SENTINEL" 2>/dev/null || true
|
||||
fi
|
||||
else
|
||||
rm -f "$REBUILD_SENTINEL" 2>/dev/null || true
|
||||
if [ -n "$HOST_REBUILD_SENTINEL" ]; then
|
||||
rm -f "$HOST_REBUILD_SENTINEL" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
# Optional: keep container alive for inspection in CI/debug contexts
|
||||
|
||||
@@ -314,23 +314,35 @@ docker compose down --remove-orphans >/dev/null 2>&1 || true
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
if [ -n "$SENTINEL_FILE" ]; then
|
||||
if ! rm -f "$SENTINEL_FILE" 2>/dev/null; then
|
||||
if [ -f "$SENTINEL_FILE" ] && command -v docker >/dev/null 2>&1; then
|
||||
DB_IMPORT_IMAGE="$(read_env AC_DB_IMPORT_IMAGE "acore/ac-wotlk-db-import:14.0.0-dev")"
|
||||
if docker image inspect "$DB_IMPORT_IMAGE" >/dev/null 2>&1; then
|
||||
docker run --rm \
|
||||
--entrypoint /bin/sh \
|
||||
--user 0:0 \
|
||||
-v "$MODULES_DIR":/modules \
|
||||
"$DB_IMPORT_IMAGE" \
|
||||
-c 'rm -f /modules/.requires_rebuild' >/dev/null 2>&1 || true
|
||||
fi
|
||||
remove_sentinel(){
|
||||
local sentinel_path="$1"
|
||||
[ -n "$sentinel_path" ] || return 0
|
||||
[ -f "$sentinel_path" ] || return 0
|
||||
if rm -f "$sentinel_path" 2>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
local db_image
|
||||
db_image="$(read_env AC_DB_IMPORT_IMAGE "acore/ac-wotlk-db-import:14.0.0-dev")"
|
||||
if docker image inspect "$db_image" >/dev/null 2>&1; then
|
||||
local mount_dir
|
||||
mount_dir="$(dirname "$sentinel_path")"
|
||||
docker run --rm \
|
||||
--entrypoint /bin/sh \
|
||||
--user 0:0 \
|
||||
-v "$mount_dir":/modules \
|
||||
"$db_image" \
|
||||
-c 'rm -f /modules/.requires_rebuild' >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
if [ -f "$SENTINEL_FILE" ]; then
|
||||
echo "⚠️ Unable to remove rebuild sentinel at $SENTINEL_FILE. Remove manually if rebuild detection persists."
|
||||
if [ -f "$sentinel_path" ]; then
|
||||
echo "⚠️ Unable to remove rebuild sentinel at $sentinel_path. Remove manually if rebuild detection persists."
|
||||
fi
|
||||
}
|
||||
|
||||
remove_sentinel "$SENTINEL_FILE"
|
||||
if [ -n "$SHARED_MODULES_DIR" ]; then
|
||||
remove_sentinel "$SHARED_MODULES_DIR/.requires_rebuild"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user