mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 00:58:34 +00:00
fix: module migration fix
This commit is contained in:
@@ -10,10 +10,13 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|||||||
ENV_FILE="$PROJECT_ROOT/.env"
|
ENV_FILE="$PROJECT_ROOT/.env"
|
||||||
|
|
||||||
read_env_value(){
|
read_env_value(){
|
||||||
local key="$1" default="$2" value="${!key:-}"
|
local key="$1" default="$2" value=""
|
||||||
if [ -z "$value" ] && [ -f "$ENV_FILE" ]; then
|
if [ -f "$ENV_FILE" ]; then
|
||||||
value="$(grep -E "^${key}=" "$ENV_FILE" 2>/dev/null | tail -n1 | cut -d'=' -f2- | tr -d '\r')"
|
value="$(grep -E "^${key}=" "$ENV_FILE" 2>/dev/null | tail -n1 | cut -d'=' -f2- | tr -d '\r')"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$value" ]; then
|
||||||
|
value="${!key:-}"
|
||||||
|
fi
|
||||||
if [ -z "$value" ]; then
|
if [ -z "$value" ]; then
|
||||||
value="$default"
|
value="$default"
|
||||||
fi
|
fi
|
||||||
@@ -42,6 +45,31 @@ resolve_project_image(){
|
|||||||
echo "${project_name}:${tag}"
|
echo "${project_name}:${tag}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure_host_writable(){
|
||||||
|
local path="$1"
|
||||||
|
[ -n "$path" ] || return 0
|
||||||
|
if [ ! -d "$path" ]; then
|
||||||
|
mkdir -p "$path" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
local uid gid
|
||||||
|
uid="$(id -u)"
|
||||||
|
gid="$(id -g)"
|
||||||
|
if ! chown -R "$uid":"$gid" "$path" 2>/dev/null; then
|
||||||
|
if command -v docker >/dev/null 2>&1; then
|
||||||
|
local helper_image
|
||||||
|
helper_image="$(read_env_value ALPINE_IMAGE "alpine:latest")"
|
||||||
|
docker run --rm \
|
||||||
|
-u 0:0 \
|
||||||
|
-v "$path":/workspace \
|
||||||
|
"$helper_image" \
|
||||||
|
sh -c "chown -R ${uid}:${gid} /workspace" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
chmod -R u+rwX "$path" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
usage(){
|
usage(){
|
||||||
cat <<'EOF_HELP'
|
cat <<'EOF_HELP'
|
||||||
Usage: $(basename "$0") --host HOST --user USER [options]
|
Usage: $(basename "$0") --host HOST --user USER [options]
|
||||||
@@ -100,7 +128,9 @@ if [ -z "$LOCAL_STORAGE_ROOT" ]; then
|
|||||||
fi
|
fi
|
||||||
LOCAL_STORAGE_ROOT="${LOCAL_STORAGE_ROOT%/}"
|
LOCAL_STORAGE_ROOT="${LOCAL_STORAGE_ROOT%/}"
|
||||||
[ -z "$LOCAL_STORAGE_ROOT" ] && LOCAL_STORAGE_ROOT="."
|
[ -z "$LOCAL_STORAGE_ROOT" ] && LOCAL_STORAGE_ROOT="."
|
||||||
|
ensure_host_writable "$LOCAL_STORAGE_ROOT"
|
||||||
TARBALL="${TARBALL:-${LOCAL_STORAGE_ROOT}/images/acore-modules-images.tar}"
|
TARBALL="${TARBALL:-${LOCAL_STORAGE_ROOT}/images/acore-modules-images.tar}"
|
||||||
|
ensure_host_writable "$(dirname "$TARBALL")"
|
||||||
|
|
||||||
SCP_OPTS=(-P "$PORT")
|
SCP_OPTS=(-P "$PORT")
|
||||||
SSH_OPTS=(-p "$PORT")
|
SSH_OPTS=(-p "$PORT")
|
||||||
@@ -212,7 +242,6 @@ setup_remote_repository(){
|
|||||||
validate_remote_environment
|
validate_remote_environment
|
||||||
|
|
||||||
echo "⋅ Exporting module images to $TARBALL"
|
echo "⋅ Exporting module images to $TARBALL"
|
||||||
mkdir -p "$(dirname "$TARBALL")"
|
|
||||||
# Check which images are available and collect them
|
# Check which images are available and collect them
|
||||||
IMAGES_TO_SAVE=()
|
IMAGES_TO_SAVE=()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user